/* ─────────────────────────────────────────────
   Digital River Technologies — Portal CSS
   ───────────────────────────────────────────── */

:root {
  --brand-dark:   #0a1628;
  --brand-blue:   #1a4fba;
  --brand-light:  #2d6cdf;
  --brand-accent: #00c6a7;
  --brand-danger: #dc3545;
  --brand-warn:   #f59e0b;
  --brand-success:#10b981;
  --text-primary: #1e293b;
  --text-muted:   #64748b;
  --border:       #e2e8f0;
  --bg-page:      #f1f5f9;
  --bg-card:      #ffffff;
  --sidebar-w:    240px;
  --radius:       10px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.06);
}

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

html { font-size: 15px; }
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; background: var(--bg-page); color: var(--text-primary); line-height: 1.6; }

a { color: var(--brand-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Auth layout ────────────────────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-blue) 100%); }
.auth-card { background: var(--bg-card); border-radius: var(--radius); padding: 2.5rem; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.auth-logo { text-align: center; margin-bottom: 1.75rem; }
.auth-logo img { height: 40px; }
.auth-logo h1 { color: var(--brand-dark); font-size: 1.4rem; font-weight: 700; margin-top: .5rem; }
.auth-card h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 1.5rem; text-align: center; }

/* ── App shell ──────────────────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar { width: var(--sidebar-w); background: var(--brand-dark); color: #e2e8f0; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; transition: transform .3s; }
.sidebar-logo { padding: 1.5rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-logo span { font-size: 1.05rem; font-weight: 700; color: #fff; letter-spacing: -.3px; }
.sidebar-logo small { display: block; font-size: .72rem; color: var(--brand-accent); margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.nav-section { padding: .4rem 1.25rem .2rem; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.35); margin-top: .75rem; }
.sidebar-nav a { display: flex; align-items: center; gap: .65rem; padding: .55rem 1.25rem; font-size: .875rem; color: rgba(255,255,255,.7); border-radius: 0; transition: background .15s, color .15s; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.sidebar-nav a.active { border-left: 3px solid var(--brand-accent); }
.sidebar-nav a svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .8; }
.sidebar-nav a.active svg { opacity: 1; }

.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .8rem; color: rgba(255,255,255,.5); }
.sidebar-footer .user-name { font-weight: 600; color: rgba(255,255,255,.8); }
.sidebar-footer a { color: rgba(255,255,255,.4); font-size: .75rem; }
.sidebar-footer a:hover { color: #fff; text-decoration: none; }

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

.topbar { background: var(--bg-card); border-bottom: 1px solid var(--border); padding: .85rem 2rem; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.topbar-title { font-size: 1rem; font-weight: 600; }
.topbar-actions { display: flex; gap: .75rem; align-items: center; }

.page-body { padding: 2rem; flex: 1; }
.page-header { margin-bottom: 1.75rem; display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.page-header h1 { font-size: 1.4rem; font-weight: 700; }
.page-header p { color: var(--text-muted); font-size: .875rem; margin-top: .25rem; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.card-header { padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: .95rem; font-weight: 600; }
.card-body { padding: 1.5rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
.stat-card { background: var(--bg-card); border-radius: var(--radius); padding: 1.25rem 1.5rem; border: 1px solid var(--border); box-shadow: var(--shadow); }
.stat-card .stat-label { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; color: var(--brand-dark); margin-top: .25rem; }
.stat-card .stat-sub { font-size: .8rem; color: var(--text-muted); margin-top: .2rem; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th { background: #f8fafc; padding: .75rem 1rem; text-align: left; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: .875rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .65rem; border-radius: 999px; font-size: .72rem; font-weight: 600; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warn    { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-muted   { background: #f1f5f9; color: #475569; }
.badge-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: .83rem; font-weight: 600; margin-bottom: .4rem; color: var(--text-primary); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: .6rem .85rem; border: 1px solid var(--border); border-radius: 7px;
  font-size: .9rem; background: var(--bg-card); color: var(--text-primary); transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--brand-light); box-shadow: 0 0 0 3px rgba(45,108,223,.12);
}
.form-hint { font-size: .77rem; color: var(--text-muted); margin-top: .3rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: .45rem; padding: .55rem 1.2rem; border-radius: 7px; font-size: .875rem; font-weight: 600; cursor: pointer; border: none; transition: opacity .15s, transform .1s; text-decoration: none; }
.btn:hover { opacity: .88; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand-blue); color: #fff; }
.btn-success { background: var(--brand-success); color: #fff; }
.btn-danger  { background: var(--brand-danger); color: #fff; }
.btn-warn    { background: var(--brand-warn); color: #fff; }
.btn-ghost   { background: transparent; color: var(--brand-blue); border: 1px solid var(--brand-blue); }
.btn-sm { padding: .35rem .85rem; font-size: .8rem; }
.btn-block { width: 100%; justify-content: center; }

.btn-google { background: #fff; color: #3c4043; border: 1px solid #dadce0; width: 100%; justify-content: center; margin-top: .75rem; font-weight: 500; }
.btn-google svg { width: 18px; height: 18px; }

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.alert { padding: .85rem 1.1rem; border-radius: 7px; font-size: .875rem; margin-bottom: 1rem; display: flex; gap: .5rem; align-items: flex-start; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warn    { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ── Divider ────────────────────────────────────────────────────────────── */
.divider { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0; color: var(--text-muted); font-size: .8rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Superadmin shell (distinct colour) ────────────────────────────────── */
.sa-sidebar { background: #0f0f23; }
.sa-sidebar .sidebar-logo small { color: #f59e0b; }
.sa-topbar { background: #f8f4ff; border-bottom-color: #e9d5ff; }

/* ── Settings grid ──────────────────────────────────────────────────────── */
.settings-grid { display: grid; gap: 1.5rem; }
.settings-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.settings-section-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: .5rem; }
.settings-section-body { padding: 1.5rem; display: grid; gap: .85rem; }

/* ── Server status ──────────────────────────────────────────────────────── */
.server-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: .85rem; box-shadow: var(--shadow); }
.server-card:hover { border-color: var(--brand-blue); }
.server-info h4 { font-size: .95rem; font-weight: 600; }
.server-info small { color: var(--text-muted); font-size: .8rem; }
.server-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Utilities ──────────────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .83rem; }
.text-right { text-align: right; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 1rem; }
.hidden { display: none !important; }
