/* eSIMFire Global Premium Design System - Vanilla CSS */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@500;600;700;800&family=Outfit:wght@600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&display=swap');

:root {
  --brand-navy: #0B1F3A;
  --brand-orange: #FF8A00;
  --brand-red: #F0442E;
  --brand-white: #FFFFFF;
  
  --text-dark: #1E293B;
  --text-muted: #64748B;
  --bg-slate: #F8FAFC;
  --border-slate: #E2E8F0;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --sidebar-width: 260px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-slate);
  color: var(--text-dark);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--brand-navy);
  font-weight: 800;
}

/* ====================================================
   LAYOUT — Sidebar + Main
   ==================================================== */

.admin-layout, .dashboard-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--brand-navy);
  color: #CBD5E1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1000;
  overflow-y: auto;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-logo {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background-color: #05101F;
}

.sidebar-nav {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: #94A3B8;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.sidebar-link:hover, .sidebar-link.active {
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--brand-white);
}

/* Main Content */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-left: var(--sidebar-width);
}

/* Top Header */
.header {
  height: 64px;
  background-color: var(--brand-white);
  border-bottom: 1px solid var(--border-slate);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Content Pane */
.content-pane {
  flex-grow: 1;
  padding: 32px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* Sidebar Overlay (for mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

/* Mobile Menu Toggle Button */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  color: var(--brand-navy);
  border-radius: 8px;
  transition: background 0.15s ease;
}

.mobile-menu-btn:hover {
  background: var(--bg-slate);
}

/* Sidebar Close Button (mobile only) */
.sidebar-close-btn {
  display: none;
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 8px;
  color: #94A3B8;
  cursor: pointer;
  z-index: 10;
}

.sidebar-close-btn:hover {
  background: rgba(255,255,255,0.2);
  color: white;
}


/* ====================================================
   UI PRIMITIVES
   ==================================================== */

.card {
  background-color: var(--brand-white);
  border: 1px solid var(--border-slate);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.card-header {
  border-bottom: 1px solid var(--bg-slate);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 800;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

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

.btn-primary:hover {
  background-color: #E07A00;
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border-slate);
  color: var(--text-dark);
}

.btn-outline:hover {
  background-color: var(--bg-slate);
}

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

.btn-danger:hover {
  background-color: #D33621;
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background-color: var(--bg-slate);
  color: var(--text-dark);
}

/* Forms */
.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-navy);
}

.form-control {
  width: 100%;
  padding: 10px 16px;
  font-size: 13px;
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--brand-navy);
  border: 2px solid var(--border-slate);
  border-radius: var(--radius-md);
  background-color: var(--brand-white);
  transition: all 0.2s ease;
  outline: none;
}

.form-control:focus {
  border-color: var(--brand-orange);
}

.form-text {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 800;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-success {
  background-color: #DEF7EC;
  color: #03543F;
}

.badge-warning {
  background-color: #FDF6B2;
  color: #723B13;
}

.badge-danger {
  background-color: #FDE8E8;
  color: #9B1C1C;
}

.badge-info {
  background-color: #E1EFFE;
  color: #1E429F;
}

.badge-neutral {
  background-color: #F3F4F6;
  color: #374151;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-slate);
  border-radius: var(--radius-lg);
  background-color: var(--brand-white);
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th {
  background-color: var(--bg-slate);
  padding: 12px 18px;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-slate);
  white-space: nowrap;
}

.table td {
  padding: 16px 18px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-slate);
  color: var(--text-dark);
}

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

/* Alert Notification Bars */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.alert-success {
  background-color: #F3FAF7;
  border-color: #DEF7EC;
  color: #03543F;
}

.alert-danger {
  background-color: #FDF2F2;
  border-color: #FDE8E8;
  color: #9B1C1C;
}

.alert-warning {
  background-color: #FDF8F2;
  border-color: #FDF6B2;
  color: #723B13;
}

/* Progress Bars */
.progress-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-label-bar {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.progress-track {
  width: 100%;
  height: 10px;
  background-color: var(--bg-slate);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border-slate);
}

.progress-fill {
  height: 100%;
  background-color: var(--brand-orange);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}


/* ====================================================
   GRID UTILITIES
   ==================================================== */

.grid-1-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 768px) {
  .grid-1-2 {
    grid-template-columns: 2fr 1fr;
  }
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 640px) {
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}


/* ====================================================
   AUTH PAGES (signin, signup, etc.)
   ==================================================== */

.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #05101F 0%, #0B1F3A 100%);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background-color: var(--brand-white);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo {
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
}

.auth-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
}


/* ====================================================
   SELECT-NONE utility
   ==================================================== */
.select-none {
  -webkit-user-select: none;
  user-select: none;
}

/* Spinner animation for loading buttons */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}


/* ====================================================
   RESPONSIVE BREAKPOINTS & MOBILE TABLE STYLING
   ==================================================== */

/* Table Responsiveness Utilities */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  margin-bottom: 0;
}

.table-responsive::-webkit-scrollbar {
  height: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: var(--border-slate);
  border-radius: 4px;
}

/* ---- Tablets & Below: 900px and below ---- */
@media (max-width: 900px) {
  /* Stacked 2-column pages (like eSIM Details) collapse to single column */
  .esim-details-grid,
  div[style*="grid-template-columns: minmax(0, 1fr) 360px"] {
    grid-template-columns: 1fr !important;
  }

  .esim-details-grid > div:last-child,
  div[style*="grid-template-columns: minmax(0, 1fr) 360px"] > div:last-child {
    position: static !important;
    top: auto !important;
  }
}

/* ---- Tablets: 768px and below ---- */
@media (max-width: 768px) {
  /* Sidebar becomes off-canvas */
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }

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

  .sidebar-close-btn {
    display: flex;
  }

  /* Main content takes full width */
  .main-content {
    margin-left: 0;
  }

  /* Show hamburger menu button */
  .mobile-menu-btn {
    display: flex;
  }

  /* Header adjustments */
  .header {
    padding: 0 16px;
    height: 56px;
  }

  /* Content pane */
  .content-pane {
    padding: 18px 14px;
  }

  /* Cards */
  .card {
    padding: 18px;
    border-radius: var(--radius-md);
  }

  /* Auth card */
  .auth-card {
    padding: 28px 20px;
  }

  /* Notification dropdown — responsive centered within viewport on mobile */
  #notif-dropdown {
    position: fixed !important;
    top: 60px !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    max-width: 400px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    max-height: calc(100vh - 80px) !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22) !important;
    z-index: 9999 !important;
  }

  /* Profile dropdown — constrained */
  #profile-dropdown {
    right: 0 !important;
  }

  /* Table padding */
  .table th, .table td {
    padding: 12px 14px;
  }

  /* Filter pill buttons */
  .order-filter-btn, .rf-filter-btn {
    padding: 6px 10px;
    font-size: 11px;
  }

  /* Renewal Entry input grids */
  .renewal-entry-row div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* eSIM Profile Card Interior Layout: Keep side-by-side on mobile, left-aligned */
  .esim-profile-card-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 130px;
    gap: 14px;
    align-items: center;
    padding: 16px;
    text-align: left;
  }
  .esim-qr-container {
    width: 125px !important;
    height: 125px !important;
  }
  .esim-phone-display {
    font-size: 19px !important;
  }

  /* ====================================================
     RESPONSIVE CARD TABLES (Card-per-record for Mobile)
     ==================================================== */
  .responsive-card-table thead {
    display: none !important;
  }

  .responsive-card-table,
  .responsive-card-table tbody {
    display: block !important;
    width: 100% !important;
  }

  .responsive-card-table tr.esf-table-row,
  .responsive-card-table tr.order-table-item,
  .responsive-card-table tr.esim-table-item,
  .responsive-card-table tr.renewal-table-row {
    display: block !important;
    width: 100% !important;
    background: #FFFFFF !important;
    border: 1px solid var(--border-slate) !important;
    border-radius: 12px !important;
    margin-bottom: 12px !important;
    padding: 12px 14px !important;
    box-sizing: border-box !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
  }

  .responsive-card-table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 9px 0 !important;
    border-bottom: 1px dashed #E2E8F0 !important;
    text-align: right !important;
    width: 100% !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    font-size: 12px !important;
  }

  .responsive-card-table td:last-child {
    border-bottom: none !important;
    padding-top: 10px !important;
    padding-bottom: 2px !important;
  }

  .responsive-card-table td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    margin-right: 12px;
    flex-shrink: 0;
  }

  .responsive-card-table td:not([data-label])::before {
    display: none !important;
  }
}

/* ---- Mobile phones: 480px and below ---- */
@media (max-width: 480px) {
  .content-pane {
    padding: 14px 10px;
  }

  .header {
    padding: 0 12px;
    height: 52px;
  }

  /* Hide username text in header on small screens */
  .header-username {
    display: none;
  }

  /* Small phone notification dropdown top adjustment */
  #notif-dropdown {
    top: 56px !important;
    left: 8px !important;
    right: 8px !important;
    max-width: calc(100vw - 16px) !important;
  }

  /* Compact balance area on small phones */
  .header-add-funds-btn {
    padding: 7px 10px !important;
    font-size: 0 !important;
  }
  .header-add-funds-btn svg {
    width: 16px;
    height: 16px;
  }

  /* eSIM Profile Card on small phones: Side-by-side & left aligned */
  .esim-profile-card-body {
    grid-template-columns: minmax(0, 1fr) 105px !important;
    gap: 10px !important;
    padding: 14px 12px !important;
    align-items: center !important;
    text-align: left !important;
  }
  .esim-qr-container {
    width: 100px !important;
    height: 100px !important;
    padding: 4px !important;
  }
  .esim-phone-display {
    font-size: 15px !important;
  }

  .card {
    padding: 14px 12px;
    margin-bottom: 14px;
    border-radius: 10px;
  }

  /* Buttons */
  .btn {
    font-size: 12px;
    padding: 8px 12px;
  }

  /* Auth */
  .auth-card {
    padding: 24px 16px;
    border-radius: var(--radius-md);
  }

  .auth-title {
    font-size: 18px;
  }

  /* Forms */
  .form-control {
    padding: 9px 12px;
    font-size: 13px;
  }

  /* Tables — compact padding for small screens */
  .table th {
    padding: 9px 10px;
    font-size: 10px;
    white-space: nowrap;
  }

  .table td {
    padding: 10px 10px;
    font-size: 11.5px;
    white-space: nowrap;
  }

  /* Grid gap reduction */
  .grid-3, .grid-2, .grid-1-2 {
    gap: 14px;
  }

  /* Responsive Dashboard Utilities */
  .dashboard-chart-card,
  .dashboard-promo-card {
    padding: 16px !important;
  }

  .dashboard-chart-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }

  .dashboard-chart-legend {
    width: 100% !important;
    justify-content: space-between !important;
  }

  .dashboard-quick-actions {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
}

/* ---- Small phones: 480px and below ---- */
@media (max-width: 480px) {
  .grid-3 {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .grid-1-2 {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .dashboard-stat-card {
    padding: 12px 14px !important;
    gap: 12px !important;
  }

  .dashboard-stat-icon {
    width: 38px !important;
    height: 38px !important;
    padding: 8px !important;
    font-size: 18px !important;
  }

  .dashboard-stat-val {
    font-size: 19px !important;
  }

  .dashboard-promo-card {
    min-height: auto !important;
  }
}

/* ---- Very small phones: 360px and below ---- */
@media (max-width: 360px) {
  .content-pane {
    padding: 10px 6px;
  }

  .card {
    padding: 12px 10px;
    margin-bottom: 10px;
  }

  .btn {
    font-size: 11px;
    padding: 7px 10px;
  }

  .auth-card {
    padding: 18px 12px;
  }
}

