/* =====================================================================
   Andijon PMM - Asosiy stillar
   ===================================================================== */

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

html { font-size: var(--font-size); scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; margin-bottom: 0.5em; }
h1 { font-size: 1.8rem; } h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; } h4 { font-size: 1.1rem; }

/* ===== Accessibility: fokus ===== */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

/* ===== Layout ===== */
.app-wrapper { display: flex; min-height: 100vh; }

.navbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--navbar-h);
  background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; z-index: 100; box-shadow: var(--shadow);
}
.navbar .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.2rem; color: var(--primary);
}
.navbar .nav-right { display: flex; align-items: center; gap: 12px; }

.sidebar {
  position: fixed; top: var(--navbar-h); left: 0; bottom: 0;
  width: var(--sidebar-w); background: var(--card);
  border-right: 1px solid var(--border);
  padding: 16px; overflow-y: auto; transition: transform var(--transition);
  z-index: 90;
}
.sidebar a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius-sm);
  color: var(--text); margin-bottom: 4px; transition: var(--transition);
  font-weight: 500;
}
.sidebar a:hover { background: var(--bg-alt); }
.sidebar a.active { background: var(--primary); color: #fff; }
.sidebar .menu-title {
  font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted);
  margin: 16px 16px 8px; letter-spacing: 0.5px;
}

.main-content {
  margin-left: var(--sidebar-w); margin-top: var(--navbar-h);
  padding: 28px; flex: 1; width: calc(100% - var(--sidebar-w));
}
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}

/* ===== Kartalar ===== */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow); margin-bottom: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ===== Tugmalar ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border: none; border-radius: var(--radius-sm);
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: var(--transition); font-family: var(--font);
  text-decoration: none; line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline {
  background: transparent; border: 1.5px solid var(--border); color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== Formalar ===== */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; margin-bottom: 6px; font-weight: 500; font-size: 0.9rem;
}
.form-control {
  width: 100%; padding: 11px 14px; font-size: 0.95rem;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  transition: var(--transition); font-family: var(--font);
}
.form-control:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 110, 110, 0.12);
}
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-error { color: var(--danger); font-size: 0.82rem; margin-top: 4px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row > .form-group { flex: 1; min-width: 200px; }

/* ===== Jadvallar ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table {
  width: 100%; border-collapse: collapse; background: var(--card);
}
table th, table td {
  padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border);
}
table th {
  background: var(--bg-alt); font-weight: 600; font-size: 0.85rem;
  text-transform: uppercase; letter-spacing: 0.3px; color: var(--text-muted);
}
table tr:hover td { background: var(--bg-alt); }

/* ===== Badge ===== */
.badge {
  display: inline-block; padding: 4px 10px; border-radius: 20px;
  font-size: 0.78rem; font-weight: 600;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }

/* ===== Alert ===== */
.alert {
  padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 18px;
  border-left: 4px solid; font-size: 0.92rem;
}
.alert-success { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.alert-danger { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning); color: var(--warning); }
.alert-info { background: var(--info-bg); border-color: var(--info); color: var(--info); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: none; align-items: center; justify-content: center; z-index: 1000;
  padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--card); border-radius: var(--radius);
  padding: 26px; max-width: 560px; width: 100%;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px;
}
.modal-close {
  background: none; border: none; font-size: 1.5rem; cursor: pointer;
  color: var(--text-muted);
}

/* ===== Progress bar ===== */
.progress {
  height: 10px; background: var(--bg-alt); border-radius: 20px; overflow: hidden;
}
.progress-bar {
  height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 20px; transition: width 0.5s ease;
}

/* ===== Dropdown ===== */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  min-width: 180px; display: none; z-index: 200; overflow: hidden;
}
.dropdown-menu.active { display: block; }
.dropdown-menu a, .dropdown-menu button {
  display: block; width: 100%; text-align: left; padding: 10px 16px;
  color: var(--text); background: none; border: none; cursor: pointer;
  font-family: var(--font); font-size: 0.9rem;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg-alt); }

/* ===== Utility ===== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}
.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}
.flex { display: flex; } .flex-between { justify-content: space-between; }
.items-center { align-items: center; } .gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.w-100 { width: 100%; }

/* ===== Responsive ===== */
.sidebar-toggle { display: none; background: none; border: none; cursor: pointer; font-size: 1.4rem; color: var(--text); }

@media (max-width: 992px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; width: 100%; padding: 18px; }
  .sidebar-toggle { display: block; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .navbar { padding: 0 16px; }
}
