/* ============================================
   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;
  }
}
