/* ===== Font & Layout ===== */
body {
  font-family: "Poppins", sans-serif;
  background-color: #f8fafc;
  color: #1e293b;
  min-height: 100vh;
  display: flex;
  transition: background-color 0.3s, color 0.3s;
}

.app {
  display: flex;
  width: 100%;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #2563eb, #1e3a8a);
  color: white;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 3px 0 20px rgba(0, 0, 0, 0.1);
}

.sidebar .brand {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 2rem;
  text-align: center;
  letter-spacing: 1px;
  color: #fff;
}

.sidebar nav a {
  color: #e0e7ff;
  display: block;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  text-decoration: none;
  margin-bottom: 0.5rem;
  transition: all 0.2s ease;
  font-weight: 500;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  transform: translateX(6px);
}

/* ===== Main Content ===== */
.content {
  flex: 1;
  background-color: #f8fafc;
  padding: 2rem 3rem;
  overflow-y: auto;
  width: 100%;
}

/* ===== Cards ===== */
.card {
  border: none;
  border-radius: 14px;
  background-color: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transition: all 0.2s ease;
  width: 100%;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.08);
}

/* ===== Stat Cards ===== */
.stat {
  text-align: center;
  padding: 1.2rem;
  background: linear-gradient(135deg, #ffffff, #f1f5f9);
  border: 1px solid #e2e8f0;
}

.stat-title {
  font-size: 0.9rem;
  color: #64748b;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #1e3a8a;
}

/* ===== Forms ===== */
.form-control,
.form-select {
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

/* ===== Buttons ===== */
.btn {
  border-radius: 10px;
  padding: 0.5rem 1rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-success {
  background-color: #2563eb;
  border: none;
}

.btn-success:hover {
  background-color: #1e40af;
}

.btn-outline-secondary {
  border: 1px solid #cbd5e1;
  color: #1e293b;
}

.btn-outline-secondary:hover {
  background-color: #1e40af;
  color: white;
  border-color: #1e40af;
}

/* ===== Login/Register Container ===== */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #2563eb 0%, #1e3a8a 100%);
}

.auth-form {
  background: white;
  padding: 2.5rem;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 420px;
}

.auth-form h3 {
  color: #1e293b;
  margin-bottom: 2rem;
  text-align: center;
  font-weight: 600;
  font-size: 1.5rem;
}

/* ===== Tables ===== */
.table {
  border-radius: 10px;
  overflow: hidden;
  font-size: 0.95rem;
}

.table thead {
  background-color: #2563eb;
  color: #fff;
}

.table-striped > tbody > tr:nth-of-type(odd) {
  background-color: #f1f5f9;
}

/* ===== Alerts ===== */
.alert {
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* ===== Charts ===== */
canvas {
  margin-top: 1rem;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-thumb {
  background: rgba(37, 99, 235, 0.3);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(37, 99, 235, 0.5);
}

/* ===== Responsive Design ===== */
/* Tablet - Medium devices (768px and below) */
@media (max-width: 768px) {
  body {
    font-size: 0.95rem;
  }

  .app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    flex-wrap: wrap;
  }

  .sidebar .brand {
    font-size: 1rem;
    margin-bottom: 0;
    margin-right: 0.75rem;
  }

  .sidebar nav {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
  }

  .sidebar nav a {
    padding: 0.45rem 0.75rem;
    margin-bottom: 0;
    font-size: 0.85rem;
  }

  .sidebar .text-center {
    display: none;
  }

  .content {
    padding: 1rem;
  }

  .card {
    margin-bottom: 0.75rem;
  }

  .table {
    font-size: 0.85rem;
  }

  .stat-value {
    font-size: 1.4rem;
  }

  .btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
  }
}

/* Mobile - Small devices (576px and below) */
@media (max-width: 576px) {
  body {
    font-size: 0.9rem;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 0.6rem 0.5rem;
    gap: 0.3rem;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .sidebar > div:first-child {
    display: flex;
    gap: 0.3rem;
    width: 100%;
    align-items: center;
  }

  .sidebar .brand {
    font-size: 0.9rem;
    margin-right: 0.5rem;
    margin-bottom: 0;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .sidebar .small {
    display: none;
  }

  .sidebar nav {
    display: flex;
    gap: 0.2rem;
    flex-wrap: nowrap;
    width: 100%;
    overflow-x: auto;
  }

  .sidebar nav a {
    padding: 0.4rem 0.5rem;
    font-size: 0.7rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .nav-text {
    display: none;
  }

  .sidebar nav a i {
    margin-right: 0;
  }

  .content {
    padding: 0.75rem 0.5rem;
  }

  .card {
    border-radius: 8px;
    margin-bottom: 0.5rem;
  }

  .card-body {
    padding: 0.75rem;
  }

  .table {
    font-size: 0.75rem;
  }

  .table td,
  .table th {
    padding: 0.35rem;
  }

  .stat {
    padding: 0.6rem;
  }

  .stat-title {
    font-size: 0.75rem;
  }

  .stat-value {
    font-size: 1.2rem;
  }

  .btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    width: 100%;
    margin-bottom: 0.4rem;
  }

  .form-control,
  .form-select {
    font-size: 0.9rem;
    padding: 0.5rem;
  }

  .form-label {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
  }

  .alert {
    padding: 0.6rem;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
  }

  .alert-dismissible .btn-close {
    padding: 0.25rem;
  }

  canvas {
    max-width: 100%;
    margin-top: 0.3rem;
  }

  .row {
    margin-right: -0.25rem;
    margin-left: -0.25rem;
  }

  .col {
    padding-right: 0.25rem;
    padding-left: 0.25rem;
  }

  .col-md-6,
  .col-md-4,
  .col-md-3,
  .col-lg-6,
  .col-lg-4 {
    width: 100% !important;
  }

  h1 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
  }

  h2 {
    font-size: 1rem;
  }

  h3 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
  }

  h6 {
    font-size: 0.85rem;
  }

  pre {
    font-size: 0.7rem;
    padding: 0.5rem !important;
    overflow-x: auto;
  }

  .auth-container {
    padding: 0.5rem;
    min-height: auto;
    justify-content: center;
    align-items: center;
  }

  .auth-form {
    padding: 1rem;
    max-width: 100%;
  }

  .auth-form h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
  }
}

/* Extra small devices (under 360px) */
@media (max-width: 360px) {
  .sidebar {
    padding: 0.4rem 0.3rem;
  }

  .sidebar .brand {
    font-size: 0.8rem;
  }

  .sidebar nav a {
    padding: 0.3rem 0.4rem;
    font-size: 0.65rem;
  }

  .content {
    padding: 0.5rem 0.3rem;
  }

  .btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
  }

  .form-control {
    font-size: 0.85rem;
    padding: 0.4rem;
  }

  h1 {
    font-size: 1rem;
  }

  h3 {
    font-size: 0.85rem;
  }
}
