/* === RESET & BASE === */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #0b1020;
  color: #e9eefc;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* === CONTAINER (Login/Signup) === */
.container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* === LAYOUT === */
.layout {
  display: flex;
  min-height: 100vh;
}

/* === SIDEBAR === */
.sidebar {
  width: 240px;
  background: #0a0f1d;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 20px;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
  transition: transform 0.3s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.brand {
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
}

.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: #e9eefc;
  cursor: pointer;
  padding: 8px;
  margin: 0;
  border-radius: 8px;
  transition: background 0.2s;
}

.menu-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

.sidebar nav a {
  display: block;
  padding: 12px 14px;
  border-radius: 10px;
  color: #cbd5f5;
  margin-bottom: 6px;
  transition: all 0.2s;
  font-size: 15px;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.sidebar nav a.active,
.sidebar nav a:hover {
  background: rgba(59, 130, 246, 0.15);
  color: #fff;
}

/* === MAIN CONTENT === */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: 240px;
}

/* === TOPBAR === */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 16px;
  flex-wrap: wrap;
}

.top-title {
  font-weight: 700;
  font-size: 18px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* === BUTTONS === */
button {
  margin-top: 14px;
  padding: 12px 18px;
  border-radius: 10px;
  border: 0;
  background: #3b82f6;
  color: white;
  font-weight: 600;
  cursor: pointer;
  font-size: 15px;
  min-height: 44px;
  transition: opacity 0.2s;
}

button:hover {
  opacity: 0.9;
}

.btn-ghost {
  width: auto;
  margin: 0;
  padding: 10px 16px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e9eefc;
  border-radius: 10px;
  cursor: pointer;
  min-height: 44px;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* === CONTENT === */
.content {
  padding: 20px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* === CARDS === */
.card {
  background: #111a2e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 20px;
  border-radius: 14px;
  margin-bottom: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* === TYPOGRAPHY === */
h1,
h2,
h3 {
  margin: 0 0 12px;
  line-height: 1.3;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 18px;
}

.hint {
  opacity: 0.75;
  font-size: 13px;
  margin: 4px 0 0;
}

/* === FORMS === */
label {
  display: block;
  margin: 14px 0 8px;
  font-size: 14px;
  opacity: 0.95;
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #0b1220;
  color: #e9eefc;
  outline: none;
  font-size: 15px;
  min-height: 44px;
  transition: border-color 0.2s;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(59, 130, 246, 0.5);
}

/* === ALERTS === */
.alert {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  font-size: 14px;
}

.alert.success {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
}

/* === TABLES === */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -20px;
  padding: 0 20px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 600px;
}

.table th,
.table td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

.table th {
  font-weight: 600;
  opacity: 0.9;
  white-space: nowrap;
}

/* === FILTERS === */
.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}

.filters > * {
  flex: 1 1 200px;
  min-width: 150px;
}

/* === GRIDS === */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.item-line {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

/* === KPI === */
.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-label {
  opacity: 0.7;
  font-size: 13px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
}

/* === SHORTCUTS === */
.shortcut {
  display: block;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
  transition: all 0.2s;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shortcut:hover {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.08);
}

/* === INLINE === */
.inline {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* === MOBILE OVERLAY === */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
}

/* === RESPONSIVE === */

/* Small phones (320px - 480px) */
@media (max-width: 480px) {
  body {
    font-size: 14px;
  }

  .content {
    padding: 16px;
  }

  .card {
    padding: 16px;
  }

  h1 {
    font-size: 20px;
  }

  h2 {
    font-size: 18px;
  }

  h3 {
    font-size: 16px;
  }

  .kpi-value {
    font-size: 22px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .shortcut-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .top-title {
    font-size: 16px;
  }

  .top-actions span {
    display: none;
  }

  .filters > * {
    flex: 1 1 100%;
  }
}

/* Tablets and small laptops (481px - 900px) */
@media (min-width: 481px) and (max-width: 900px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .item-line {
    grid-template-columns: 2fr 1fr;
  }
}

/* Desktop (901px+) */
@media (min-width: 901px) {
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .item-line {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

/* Mobile navigation (0 - 900px) */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .menu-toggle {
    display: block;
  }

  #menuClose {
    display: block;
  }

  .sidebar-overlay {
    display: block;
  }

  .topbar {
    padding: 12px 16px;
  }

  .table-wrapper {
    margin: 0 -16px;
    padding: 0 16px;
  }

  .table {
    font-size: 13px;
  }

  .table th,
  .table td {
    padding: 10px 8px;
  }
}

/* Desktop only - hide mobile menu elements */
@media (min-width: 901px) {
  #menuToggle,
  #menuClose {
    display: none !important;
  }

  .sidebar-overlay {
    display: none !important;
  }
}

/* Print styles */
@media print {
  .sidebar,
  .topbar,
  button,
  .btn-ghost {
    display: none !important;
  }

  .main {
    margin-left: 0;
  }

  .card {
    box-shadow: none;
    page-break-inside: avoid;
  }
}
