/* ============================================
   Niwala Admin Panel - Orange & White Theme
   ============================================ */

:root {
  --primary: #FF6B1A;
  --primary-dark: #E55A0F;
  --primary-light: #FFE8DA;
  --primary-faded: #FFF5EE;
  --white: #FFFFFF;
  --bg: #FAFAFA;
  --text: #1A1A1A;
  --text-muted: #6B6B6B;
  --border: #E5E5E5;
  --success: #16A34A;
  --warning: #F59E0B;
  --danger: #DC2626;
  --info: #2563EB;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(255,107,26,0.15);
  --radius: 10px;
  --radius-lg: 16px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
}

/* ===== AUTH PAGES (Login, Forgot) ===== */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, #FF8845 100%);
  padding: 20px;
}

.auth-box {
  background: var(--white);
  padding: 48px 40px;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo .brand {
  font-size: 36px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -1px;
}

.auth-logo .tagline {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.auth-box h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 6px;
  text-align: center;
}

.auth-box .subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 28px;
}

/* ===== FORM ELEMENTS ===== */
.form-group {
  margin-bottom: 18px;
}

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

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

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 22px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-block {
  width: 100%;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover { background: #15803D; }

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover { background: #B91C1C; }

.btn-outline {
  background: white;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary-light);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 12px;
}

/* ===== AUTH FOOTER LINK ===== */
.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-footer a:hover { text-decoration: underline; }

/* ===== ALERT MESSAGES ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.alert.show { display: block; }

.alert-error {
  background: #FEF2F2;
  color: var(--danger);
  border: 1px solid #FECACA;
}

.alert-success {
  background: #F0FDF4;
  color: var(--success);
  border: 1px solid #BBF7D0;
}

.alert-info {
  background: var(--primary-faded);
  color: var(--primary-dark);
  border: 1px solid var(--primary-light);
}

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

.sidebar {
  width: 240px;
  background: var(--white);
  border-right: 1px solid var(--border);
  position: fixed;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header .brand {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.sidebar-header .role {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  margin-bottom: 4px;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}

.sidebar-nav a:hover {
  background: var(--primary-faded);
  color: var(--primary);
}

.sidebar-nav a.active {
  background: var(--primary);
  color: white;
}

.sidebar-nav .icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.user-info {
  font-size: 13px;
  margin-bottom: 10px;
}

.user-info .name {
  font-weight: 600;
}

.user-info .email {
  color: var(--text-muted);
  font-size: 11px;
}

.main-content {
  margin-left: 240px;
  flex: 1;
  padding: 32px;
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 26px;
  font-weight: 700;
}

.page-header .subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 2px;
}

/* ===== STATS CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--white);
  padding: 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.stat-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.stat-card .label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.stat-card .extra {
  font-size: 12px;
  color: var(--text-muted);
}

.stat-card.highlight {
  background: linear-gradient(135deg, var(--primary) 0%, #FF8845 100%);
  border: none;
}

.stat-card.highlight .label,
.stat-card.highlight .value,
.stat-card.highlight .extra {
  color: white;
}

.stat-card.highlight .label {
  opacity: 0.9;
}

/* ===== TABLE ===== */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

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

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

.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius);
}

.tab {
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-muted);
  transition: all 0.15s;
  font-family: inherit;
}

.tab.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 12px 22px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover {
  background: var(--primary-faded);
}

/* ===== STATUS BADGES ===== */
.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-pending  { background: #FEF3C7; color: #92400E; }
.badge-approved { background: #DCFCE7; color: #166534; }
.badge-rejected { background: #FEE2E2; color: #991B1B; }
.badge-placed { background: #DBEAFE; color: #1E40AF; }
.badge-accepted, .badge-preparing { background: #FEF3C7; color: #92400E; }
.badge-ready, .badge-picked_up, .badge-on_the_way { background: #E0E7FF; color: #3730A3; }
.badge-delivered { background: #DCFCE7; color: #166534; }
.badge-cancelled { background: #FEE2E2; color: #991B1B; }

/* ===== ACTIONS ===== */
.actions {
  display: flex;
  gap: 6px;
}

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state .title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text);
}

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-backdrop.show { display: flex; }

.modal {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
}

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

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

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.modal-body {
  padding: 22px;
}

.detail-row {
  display: flex;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.detail-row:last-child { border-bottom: none; }

.detail-row .label {
  width: 140px;
  color: var(--text-muted);
  font-weight: 500;
}

.detail-row .value {
  flex: 1;
  font-weight: 500;
}

/* ===== LOADER ===== */
.loader {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loader-center {
  display: flex;
  justify-content: center;
  padding: 60px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 100;
    transition: transform 0.3s;
  }
  .sidebar.show { transform: translateX(0); }
  .main-content {
    margin-left: 0;
    padding: 20px;
  }
  .data-table {
    font-size: 12px;
  }
  .data-table th,
  .data-table td {
    padding: 10px 12px;
  }
}

/* ===== REFRESHED ADMIN TOP LAYOUT ===== */
.admin-wordmark,
.dashboard-welcome h2,
.feature-card h3,
.footer-brand {
  font-family: "Book Antiqua", Palatino, "Palatino Linotype", serif;
  letter-spacing: 0;
}

.app-layout {
  display: block;
}

.main-content {
  margin-left: auto;
  margin-right: auto;
  max-width: 1240px;
  padding: 32px;
}

.admin-home-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 36px 32px 0;
}

.admin-top-header {
  min-height: 104px;
  background: linear-gradient(135deg, var(--primary) 0%, #ff8845 100%);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  box-shadow: 0 8px 22px rgba(255, 107, 26, 0.24);
}

.admin-wordmark {
  color: var(--white);
  font-size: 46px;
  font-weight: 700;
  line-height: 1;
}

.brand-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.38);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.top-nav {
  min-height: 62px;
  background: #050505;
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 28px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

.top-nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.top-nav-links a {
  color: var(--white);
  text-decoration: none;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 650;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.top-nav-links a:hover,
.top-nav-links a.active {
  background: var(--white);
  color: #050505;
  border-color: var(--white);
  transform: translateY(-1px);
}

.admin-hero-panel {
  background:
    linear-gradient(135deg, rgba(255, 107, 26, 0.96), rgba(255, 136, 69, 0.9)),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.38), transparent 32%);
  color: var(--white);
  border-radius: 24px;
  padding: 44px;
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 34px;
  align-items: center;
  box-shadow: 0 18px 42px rgba(255, 107, 26, 0.22);
}

.hero-kicker {
  text-transform: uppercase;
  letter-spacing: 1.8px;
  font-size: 12px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 12px;
}

.admin-hero-panel h1 {
  font-family: "Book Antiqua", Palatino, "Palatino Linotype", serif;
  font-size: 44px;
  line-height: 1.08;
  max-width: 680px;
  margin-bottom: 16px;
}

.admin-hero-panel p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  max-width: 720px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 26px;
  flex-wrap: wrap;
}

.admin-hero-panel .btn-primary {
  background: #050505;
}

.admin-hero-panel .btn-primary:hover {
  background: #202020;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
}

.admin-hero-panel .btn-outline {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.7);
}

.admin-hero-panel .btn-outline:hover {
  background: var(--white);
  color: #050505;
}

.hero-metrics {
  display: grid;
  gap: 14px;
}

.hero-metrics div {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 18px;
  padding: 18px;
  backdrop-filter: blur(4px);
}

.hero-metrics strong {
  display: block;
  font-size: 28px;
  line-height: 1;
  margin-bottom: 6px;
}

.hero-metrics span {
  color: rgba(255, 255, 255, 0.84);
}

.home-section {
  margin-top: 32px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.section-heading h2,
.ops-section h2 {
  font-family: "Book Antiqua", Palatino, "Palatino Linotype", serif;
  font-size: 28px;
}

.section-heading p,
.ops-section p {
  color: var(--text-muted);
}

.top-nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-nav-user .user-info {
  color: var(--white);
  margin-bottom: 0;
  text-align: right;
}

.top-nav-user .email {
  color: rgba(255, 255, 255, 0.72);
}

.top-nav-user .btn-outline {
  background: transparent;
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.62);
}

.top-nav-user .btn-outline:hover {
  background: var(--white);
  color: #050505;
}

.dashboard-welcome {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  margin-bottom: 26px;
  box-shadow: var(--shadow);
}

.dashboard-welcome h2 {
  font-size: 30px;
  color: var(--primary);
  margin-bottom: 8px;
}

.dashboard-welcome p {
  color: var(--text-muted);
  max-width: 820px;
  font-size: 15px;
}

.feature-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

.feature-card {
  background: var(--white);
  border: 1.5px solid var(--primary-light);
  border-radius: 18px;
  padding: 18px;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.home-feature-row .feature-card {
  min-height: 146px;
}

.feature-card:hover {
  transform: scale(1.035);
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
  box-shadow: 0 16px 28px rgba(255, 107, 26, 0.22);
}

.feature-card h3 {
  font-size: 17px;
  margin-bottom: 6px;
}

.feature-card p {
  font-size: 13px;
  color: var(--text-muted);
}

.feature-card:hover p {
  color: rgba(255, 255, 255, 0.9);
}

.admin-footer {
  background: #050505;
  color: var(--white);
  margin-top: 40px;
  padding: 34px 36px;
  border-radius: 24px 24px 0 0;
  display: grid;
  grid-template-columns: 1.5fr 0.8fr 1fr 1fr;
  gap: 26px;
  border-top: 4px solid var(--primary);
}

.footer-brand {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.admin-footer p,
.admin-footer div {
  color: rgba(255, 255, 255, 0.78);
}

.admin-footer h4 {
  color: var(--white);
  margin-bottom: 8px;
}

.admin-footer a {
  color: rgba(255, 255, 255, 0.78);
  display: block;
  text-decoration: none;
  margin-bottom: 6px;
}

.admin-footer a:hover {
  color: var(--primary);
}

.footer-about p {
  max-width: 420px;
}

.ops-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 26px;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 24px;
  align-items: center;
  box-shadow: var(--shadow);
}

.ops-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ops-list span {
  border: 1px solid var(--primary-light);
  background: var(--primary-faded);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--primary-dark);
  font-weight: 650;
}

@media (max-width: 768px) {
  .top-nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-nav-user {
    width: 100%;
    justify-content: space-between;
  }

  .admin-wordmark {
    font-size: 36px;
  }

  .feature-row,
  .admin-footer,
  .admin-hero-panel,
  .ops-section,
  .ops-list {
    grid-template-columns: 1fr;
  }

  .admin-home-main {
    padding: 24px 18px 0;
  }

  .admin-hero-panel {
    padding: 28px;
  }

  .admin-hero-panel h1 {
    font-size: 34px;
  }
}
