/* Base Reset & Variables */
:root {
  --bg-color: #f7f9fa;
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
  --text-main: #2d3436;
  --text-sub: #636e72;
  --accent-red: #ff4757;
  --accent-red-hover: #ff6b81;
  --accent-red-light: rgba(255, 71, 87, 0.1);
  --border-light: #dfe6e9;
  --border-hover: #b2bec3;
  --radius: 12px;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Glassmorphism Classes */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius);
}

/* Screens */
.screen {
  display: none;
  opacity: 0;
  transition: var(--transition);
}

.screen.active {
  display: flex;
  opacity: 1;
}

/* Auth / Login */
#login-screen {
  height: 100vh;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 40px;
  text-align: center;
  animation: slideUp 0.6s ease;
}

.login-card h1 {
  font-weight: 600;
  font-size: 24px;
  margin-bottom: 8px;
  color: var(--accent-red);
}

.login-card p {
  color: var(--text-sub);
  font-size: 14px;
  margin-bottom: 30px;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.login-card input {
  padding: 12px 15px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  font-size: 15px;
  outline: none;
  transition: var(--transition);
  background: #fff;
}

.login-card input:focus {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 3px var(--accent-red-light);
}

.divider {
  margin: 25px 0;
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--border-hover);
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-light);
}

.divider span {
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
}

/* Buttons */
.btn {
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  outline: none;
  font-family: inherit;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn.primary {
  background-color: var(--accent-red);
  color: #fff;
}

.btn.primary:hover {
  background-color: var(--accent-red-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--accent-red-light);
}

.btn.primary:active {
  transform: translateY(0);
}

.btn.text-btn {
  background: transparent;
  color: var(--text-sub);
}
.btn.text-btn:hover {
  color: var(--accent-red);
  background: var(--accent-red-light);
}

.error-msg {
  color: var(--accent-red);
  font-size: 13px;
  margin-top: 15px;
  min-height: 20px;
}

/* Dashboard Layout */
#dashboard-screen {
  display: none;
  height: 100vh;
  width: 100vw;
  flex-direction: row;
  overflow: hidden;
}

#dashboard-screen.active {
  display: flex;
}

/* Sidebar */
.sidebar {
  width: 260px;
  margin: 20px 0 20px 20px;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.sidebar .logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  padding: 0 20px 30px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 20px;
}
.sidebar .logo::after {
  content: ".uz";
  color: var(--accent-red);
}

.sidebar nav {
  flex: 1;
}

.sidebar ul {
    list-style: none;
    flex-grow: 1;
}

.nav-section-title {
    color: var(--text-sub);
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    margin: 15px 0 5px 20px;
    letter-spacing: 0.05em;
}

.sidebar li {
  padding: 12px 20px;
  margin: 5px 15px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-sub);
  font-weight: 500;
  transition: var(--transition);
  display: flex;
  align-items: center;
}

.sidebar li:hover {
  background: var(--accent-red-light);
  color: var(--accent-red);
  transform: translateX(4px);
}

.sidebar li.active {
  background: var(--accent-red);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-red-light);
}

.sidebar-bottom {
  padding: 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#user-display {
  font-weight: 600;
  font-size: 14px;
}

/* Main Content Area */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.topbar {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
}

.topbar h2 {
  font-weight: 500;
  font-size: 20px;
}

.page-container {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
}

.placeholder {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: var(--text-sub);
  font-size: 15px;
  animation: fadeIn 0.4s ease;
}

/* Tables */
.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}
.table-toolbar input.search-input {
  flex: 1;
  max-width: 350px;
}

/* Premium Glassy Inputs Globally */
input, select, .search-input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-main);
  outline: none;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
}

input:focus, select:focus, .search-input:focus {
  background: #fff;
  border-color: var(--accent-red);
  box-shadow: 0 0 0 4px var(--accent-red-light);
  transform: translateY(-1px);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%237D879C%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat, repeat;
  background-position: right .7em top 50%, 0 0;
  background-size: .65em auto, 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

thead th {
  padding: 15px;
  font-weight: 600;
  color: var(--text-sub);
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  user-select: none;
}

thead th.sortable {
  cursor: pointer;
  transition: color 0.2s;
}

thead th.sortable:hover {
  color: var(--accent-red);
}

thead th.sortable::after {
  content: '↕';
  margin-left: 5px;
  opacity: 0.3;
}

thead th.sortable.sort-asc::after {
  content: '↑';
  opacity: 1;
  color: var(--accent-red);
}

thead th.sortable.sort-desc::after {
  content: '↓';
  opacity: 1;
  color: var(--accent-red);
}

tbody td {
  padding: 15px;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
  vertical-align: middle;
}

tbody tr {
  transition: var(--transition);
}

tbody tr:hover {
  background-color: #fafbfc;
  transform: translateY(-1px);
}

/* Pagination Controls */
.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  margin-top: 10px;
  border-top: 1px solid var(--border-light);
}

.table-footer .rows-select {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-sub);
  font-size: 14px;
}

.table-footer .rows-select select {
  width: auto;
  padding: 6px 30px 6px 12px;
}

.pagination {
  display: flex;
  gap: 5px;
  align-items: center;
}

.page-btn {
  padding: 6px 12px;
  border: 1px solid var(--border-light);
  background: white;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-main);
  font-size: 14px;
  transition: var(--transition);
}

.page-btn:hover:not(:disabled) {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.page-btn.active {
  background: var(--accent-red);
  color: white;
  border-color: var(--accent-red);
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-info {
  margin: 0 10px;
  font-size: 14px;
  color: var(--text-sub);
}

/* Animations */
@keyframes slideUp {
  0% { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* Utilities */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* ========================
   TOAST NOTIFICATIONS
   ======================== */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: 10px;
  background: white;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  opacity: 0;
  transform: translateX(40px);
  transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
  pointer-events: auto;
  min-width: 280px;
  max-width: 400px;
  border-left: 4px solid #ddd;
}

.toast.toast-show {
  opacity: 1;
  transform: translateX(0);
}

.toast-success { border-left-color: #0d8246; }
.toast-error   { border-left-color: var(--accent-red); }
.toast-info    { border-left-color: #0284c7; }

.toast-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.toast-success .toast-icon { background: #e3fcef; color: #0d8246; }
.toast-error .toast-icon   { background: #ffe3e3; color: var(--accent-red); }
.toast-info .toast-icon    { background: #e0f2fe; color: #0284c7; }

/* ========================
   MODAL
   ======================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 8888;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.modal-show {
  opacity: 1;
}

.modal-overlay.modal-show .modal-card {
  transform: translateY(0);
  opacity: 1;
}

.modal-card {
  width: 100%;
  max-width: 460px;
  padding: 0;
  overflow: hidden;
  transform: translateY(24px);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-sub);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--accent-red); }

.modal-body {
  padding: 24px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-main);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn.secondary {
  background: var(--bg-color);
  color: var(--text-sub);
  border: 1px solid var(--border-light);
}
.btn.secondary:hover {
  background: var(--border-light);
  color: var(--text-main);
}

/* ========================
   OPERATION CARD
   ======================== */
.op-card {
  max-width: 620px;
  margin: 0 auto;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 32px;
}

.op-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}

.op-card > p {
  color: var(--text-sub);
  font-size: 14px;
  margin-bottom: 24px;
}

.op-card label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  margin-bottom: 6px;
  margin-top: 16px;
}

.op-card label:first-of-type {
  margin-top: 0;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.full-width { width: 100%; margin-top: 20px; }

/* ========================
   STATUS RESULT PANEL
   ======================== */
.result-card {
  background: var(--bg-color);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 20px;
}

.result-summary {
  font-size: 14px;
  margin-bottom: 16px;
  color: var(--text-sub);
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.result-table th {
  padding: 10px 14px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-sub);
  border-bottom: 1px solid var(--border-light);
}

.result-table td {
  padding: 10px 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-light);
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.action-btn {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: all 0.25s ease;
}

.action-btn.activate {
  background: #e3fcef;
  color: #0d8246;
  border: 1px solid #a7f3d0;
}
.action-btn.activate:hover { background: #0d8246; color: white; }

.action-btn.suspend {
  background: #ffe3e3;
  color: var(--accent-red);
  border: 1px solid #ffc9c9;
}
.action-btn.suspend:hover { background: var(--accent-red); color: white; }

.action-btn.used {
  background: #f3f0ff;
  color: #6b46c1;
  border: 1px solid #d9d3ff;
}
.action-btn.used:hover { background: #6b46c1; color: white; }

.result-empty {
  text-align: center;
  padding: 30px;
  color: var(--text-sub);
  font-size: 14px;
}

/* ========================
   USER MANAGEMENT
   ======================== */

/* Modal form layout */
.modal-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-form label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  margin-top: 8px;
}

.modal-form label:first-child {
  margin-top: 0;
}

.modal-form input,
.modal-form select {
  width: 100%;
  margin-bottom: 2px;
}

.field-note {
  font-size: 11px;
  font-weight: 400;
  color: var(--border-hover);
}

.field-hint {
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--bg-color);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-sub);
  border: 1px solid var(--border-light);
}

.field-hint code {
  font-family: monospace;
  color: var(--text-main);
  font-size: 13px;
}

/* Danger button variant */
.btn.danger,
.btn.primary.danger {
  background-color: var(--accent-red);
  color: #fff;
}
.btn.danger:hover,
.btn.primary.danger:hover {
  background-color: #cc1a2b;
  box-shadow: 0 4px 12px rgba(255, 71, 87, 0.35);
}

/* Action column in table */
.action-cell {
  text-align: center;
  white-space: nowrap;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  font-family: inherit;
  outline: none;
  margin: 0 2px;
}

.btn-action.edit {
  background: #e0f2fe;
  color: #0284c7;
  border-color: #b3e0f9;
}
.btn-action.edit:hover {
  background: #0284c7;
  color: #fff;
  transform: translateY(-1px);
}

.btn-action.disable {
  background: #ffe3e3;
  color: var(--accent-red);
  border-color: #ffc9c9;
}
.btn-action.disable:hover:not(:disabled) {
  background: var(--accent-red);
  color: #fff;
  transform: translateY(-1px);
}
.btn-action.disable:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Role badges */
.role-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.role-badge.admin {
  background: #fef3c7;
  color: #92400e;
}
.role-badge.manager {
  background: #ede9fe;
  color: #5b21b6;
}

