/* ISP Manager Pro - Dark Industrial Theme */
:root {
  --bg-base: #0a0c0f;
  --bg-surface: #111318;
  --bg-card: #161a20;
  --bg-elevated: #1c2128;
  --bg-hover: #222830;
  --border: #2a3040;
  --border-light: #343d4f;
  --text-primary: #e8edf5;
  --text-secondary: #8899b0;
  --text-muted: #4a5568;
  --accent: #00d4aa;
  --accent-dim: rgba(0, 212, 170, 0.12);
  --accent-mid: rgba(0, 212, 170, 0.25);
  --danger: #ff4757;
  --danger-dim: rgba(255, 71, 87, 0.12);
  --warning: #ffa502;
  --warning-dim: rgba(255, 165, 2, 0.12);
  --info: #2f86eb;
  --info-dim: rgba(47, 134, 235, 0.12);
  --success: #2ed573;
  --success-dim: rgba(46, 213, 115, 0.12);
  --font-main: 'Sora', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.6);
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --transition: 0.2s ease;
}

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

html, body {
  height: 100%;
  font-family: var(--font-main);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
}

/* ===================== LOGIN ===================== */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-base);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(0,212,170,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(47,134,235,0.04) 0%, transparent 50%);
}

.login-card {
  width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.brand-icon {
  font-size: 36px;
  color: var(--accent);
  display: block;
  margin-bottom: 12px;
}

.login-brand h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.login-brand p {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 4px;
}

/* ===================== APP SHELL ===================== */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform var(--transition);
  z-index: 100;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-h);
}

.sidebar-brand .brand-icon {
  font-size: 22px;
  color: var(--accent);
  margin-bottom: 0;
}

.brand-text { display: flex; flex-direction: column; }
.brand-title { font-size: 15px; font-weight: 700; letter-spacing: -0.3px; }
.brand-sub { font-size: 11px; color: var(--text-secondary); }

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

.nav-section { margin-bottom: 6px; }

.nav-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 8px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 400;
  transition: all var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent-mid);
  font-weight: 500;
}

.nav-icon { font-size: 14px; width: 18px; text-align: center; }

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }

.user-avatar {
  width: 34px; height: 34px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-mid);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: var(--accent);
  flex-shrink: 0;
}

.user-details { min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-secondary); text-transform: capitalize; }

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 30px; height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger); }

/* ===================== MAIN CONTENT ===================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
}

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

.sidebar-toggle {
  background: none; border: none;
  color: var(--text-secondary); font-size: 18px;
  cursor: pointer; display: none;
  padding: 4px;
}

.page-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.alert-badge {
  display: flex; align-items: center; gap: 6px;
  background: var(--warning-dim);
  border: 1px solid var(--warning);
  border-radius: 20px;
  padding: 4px 12px;
  color: var(--warning);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.topbar-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ===================== CARDS ===================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ===================== STATS GRID ===================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}

.stat-card.green::before { background: var(--accent); }
.stat-card.red::before { background: var(--danger); }
.stat-card.yellow::before { background: var(--warning); }
.stat-card.blue::before { background: var(--info); }
.stat-card.purple::before { background: #a855f7; }

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ===================== TABLES ===================== */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.table-toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.table-toolbar-right { display: flex; align-items: center; gap: 10px; }

.table-title {
  font-size: 14px;
  font-weight: 600;
}

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

thead tr {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  font-size: 13.5px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }

.td-mono { font-family: var(--font-mono); font-size: 12.5px; }

/* ===================== BADGES ===================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.badge-active { background: var(--success-dim); color: var(--success); border: 1px solid rgba(46,213,115,0.3); }
.badge-expired { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(255,71,87,0.3); }
.badge-expiring { background: var(--warning-dim); color: var(--warning); border: 1px solid rgba(255,165,2,0.3); }
.badge-suspended { background: var(--info-dim); color: var(--info); border: 1px solid rgba(47,134,235,0.3); }
.badge-inactive { background: rgba(74,85,104,0.2); color: var(--text-muted); border: 1px solid var(--border); }
.badge-received { background: var(--success-dim); color: var(--success); border: 1px solid rgba(46,213,115,0.3); }
.badge-pending { background: var(--warning-dim); color: var(--warning); border: 1px solid rgba(255,165,2,0.3); }
.badge-gws { background: var(--info-dim); color: var(--info); border: 1px solid rgba(47,134,235,0.3); }
.badge-adarsh { background: rgba(168,85,247,0.12); color: #a855f7; border: 1px solid rgba(168,85,247,0.3); }

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

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

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

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input, select, textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 13.5px;
  transition: border-color var(--transition);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

select option { background: var(--bg-elevated); }
textarea { resize: vertical; min-height: 80px; }
input::placeholder { color: var(--text-muted); }

.input-search {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 12px;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 13px;
  outline: none;
  width: 240px;
}
.input-search:focus { border-color: var(--accent); }

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}
.btn-primary:hover { background: #00f0c0; border-color: #00f0c0; }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--border-light); background: var(--bg-hover); }

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border-color: rgba(255,71,87,0.3);
}
.btn-danger:hover { background: rgba(255,71,87,0.2); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 30px; height: 30px;
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ===================== MODAL ===================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

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

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

.modal-close {
  background: none; border: none;
  color: var(--text-secondary); font-size: 16px;
  cursor: pointer; width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  flex-shrink: 0;
}

/* ===================== ALERTS ===================== */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 12px;
}
.alert-error { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(255,71,87,0.3); }
.alert-success { background: var(--success-dim); color: var(--success); border: 1px solid rgba(46,213,115,0.3); }
.alert-warning { background: var(--warning-dim); color: var(--warning); border: 1px solid rgba(255,165,2,0.3); }

/* ===================== TOAST ===================== */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  min-width: 260px;
  max-width: 380px;
  box-shadow: var(--shadow);
  animation: slideInToast 0.3s ease;
  display: flex; align-items: center; gap: 10px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }

@keyframes slideInToast {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===================== PAGINATION ===================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

.pagination-btns { display: flex; gap: 4px; }
.pagination-btn {
  width: 28px; height: 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 12px;
  transition: all var(--transition);
}
.pagination-btn:hover, .pagination-btn.active {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-dim);
}

/* ===================== EMPTY STATE ===================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-icon { font-size: 40px; margin-bottom: 14px; }
.empty-text { font-size: 15px; font-weight: 500; color: var(--text-secondary); }
.empty-sub { font-size: 13px; margin-top: 6px; }

/* ===================== LOADING ===================== */
.loading-spinner {
  display: flex; align-items: center; justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== SECTION HEADING ===================== */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}

.section-title { font-size: 18px; font-weight: 700; }
.section-sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ===================== FILTERS ===================== */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.filter-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  color: var(--text-primary);
  font-size: 12.5px;
  font-family: var(--font-main);
  outline: none;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--accent); }

/* ===================== DAYS LEFT INDICATOR ===================== */
.days-indicator {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
}
.days-ok { color: var(--success); }
.days-warn { color: var(--warning); }
.days-bad { color: var(--danger); }

/* ===================== REVENUE CARD ===================== */
.revenue-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block !important; }
  .main-content { width: 100%; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .revenue-grid { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
  .input-search { width: 180px; }
}

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ===================== MISC ===================== */
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-mono { font-family: var(--font-mono); }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

.info-row {
  display: flex; justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-secondary); }
.info-value { font-weight: 500; }
