/* ============================================================
   INTESO Admin Panel — CSS
   Colors: #E8622A (orange), #1a2332 (dark navy), #f4f6f9 (bg)
   ============================================================ */

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

:root {
  --orange:   #E8622A;
  --navy:     #1a2332;
  --navy-light: #243044;
  --bg:       #f4f6f9;
  --white:    #ffffff;
  --border:   #e2e8f0;
  --text:     #2d3748;
  --muted:    #718096;
  --success:  #27ae60;
  --warning:  #f39c12;
  --danger:   #e74c3c;
  --info:     #3498db;
  --sidebar-w: 240px;
  --radius:   8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  min-height: 100vh;
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo img {
  height: 36px;
  width: auto;
}

.sidebar-nav {
  list-style: none;
  padding: 16px 0;
  flex: 1;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 13.5px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
  color: #fff;
  background: rgba(255,255,255,0.06);
  border-left-color: var(--orange);
}

.sidebar-nav li a svg { opacity: 0.7; flex-shrink: 0; }
.sidebar-nav li a:hover svg,
.sidebar-nav li a.active svg { opacity: 1; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s;
}
.logout-btn:hover { color: var(--orange); }

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Topbar ---- */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: none;
  padding: 4px;
}

.topbar-right { display: flex; align-items: center; gap: 16px; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

/* ---- Page Header ---- */
.page-header {
  padding: 24px 28px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
}

.page-header p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

/* ---- Stats Grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 20px 28px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid var(--border);
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.orange { background: rgba(232,98,42,0.12); color: var(--orange); }
.stat-icon.green  { background: rgba(39,174,96,0.12);  color: var(--success); }
.stat-icon.yellow { background: rgba(243,156,18,0.12); color: var(--warning); }
.stat-icon.blue   { background: rgba(52,152,219,0.12); color: var(--info); }

.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--navy); line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---- Charts ---- */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  padding: 0 28px 16px;
}

.chart-card { }
.chart-card-sm { }

/* ---- Cards ---- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin: 0 28px 20px;
  overflow: hidden;
}

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

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
}

.card-body { padding: 16px 20px; }

.alert-card { border-left: 4px solid var(--warning); }

/* ---- Tables ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  background: #f8fafc;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }
.data-table .row-danger td { background: #fff5f5; }
.data-table .row-warning td { background: #fffbf0; }

.actions-cell { white-space: nowrap; }

/* ---- Info Table ---- */
.info-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.info-table td { padding: 8px 4px; border-bottom: 1px solid #f1f5f9; }
.info-table td:first-child { color: var(--muted); width: 45%; }

/* ---- Detail Grid ---- */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 0 28px 0;
  margin-bottom: 0;
}
.detail-grid .card { margin: 0; }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success   { background: #d4edda; color: #155724; }
.badge-warning   { background: #fff3cd; color: #856404; }
.badge-danger    { background: #f8d7da; color: #721c24; }
.badge-info      { background: #d1ecf1; color: #0c5460; }
.badge-secondary { background: #e2e8f0; color: #4a5568; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary  { background: var(--orange); color: #fff; }
.btn-primary:hover { background: #d4541f; }

.btn-outline  { background: transparent; color: var(--navy); border: 1px solid var(--border); }
.btn-outline:hover { background: #f8fafc; }

.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ---- Forms ---- */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--navy);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.2s;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(232,98,42,0.1);
}

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

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.required { color: var(--danger); }

/* ---- Alerts ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin: 16px 28px;
  font-size: 13.5px;
}

.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* ---- Filter Card ---- */
.filter-card { margin-bottom: 16px; }
.filter-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px 20px;
}

.filter-form input,
.filter-form select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--text);
  background: var(--white);
}

.filter-form input { flex: 1; min-width: 200px; }

/* ---- Login Page ---- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--navy);
  margin-left: 0;
}

.login-container {
  background: var(--white);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo img {
  height: 48px;
}

.login-container h2 {
  text-align: center;
  font-size: 18px;
  color: var(--navy);
  margin-bottom: 24px;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .stats-grid { grid-template-columns: 1fr 1fr; padding: 16px; }
  .page-header, .card, .alert { padding-left: 16px; padding-right: 16px; }
  .card { margin-left: 16px; margin-right: 16px; }
  .form-row { grid-template-columns: 1fr; }
}
