/* =========================================
   Alaska Solars – Admin Panel Styles
   ========================================= */

:root {
    --primary: #0d3b6e;
    --primary-light: #1a5a9a;
    --accent: #f5a623;
    --green: #27ae60;
    --red: #e74c3c;
    --orange: #f39c12;
    --gray: #6b7280;
    --gray-light: #f3f4f6;
    --sidebar-bg: #0f2942;
    --sidebar-width: 250px;
    --white: #ffffff;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,.1);
    --radius: 10px;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font);
    background: #f0f2f5;
    color: #1f2937;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ── Login Page ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.login-card {
    background: var(--white);
    border-radius: 16px;
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo svg { width: 52px; height: 52px; }
.login-logo-img { height: 64px; width: auto; }
.login-logo h1 { font-size: 1.4rem; font-weight: 700; color: var(--primary); margin-top: 10px; }
.login-logo p  { font-size: .85rem; color: var(--gray); margin-top: 8px; }

/* ── Layout ── */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 50;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header svg { width: 38px; height: 38px; flex-shrink: 0; }

.sidebar-logo {
    height: 32px;
    width: auto;
    background: var(--white);
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.sidebar-header .s-title  { font-size: .95rem; font-weight: 700; color: var(--white); }
.sidebar-header .s-sub    { font-size: .7rem; color: rgba(255,255,255,.5); }

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

.sidebar-nav .nav-label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,.35);
    padding: 8px 10px 4px;
    margin-top: 8px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,.75);
    font-size: .88rem;
    font-weight: 500;
    transition: background .15s, color .15s;
    margin-bottom: 2px;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255,255,255,.1);
    color: var(--white);
}

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

.sidebar-nav svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
    padding: 14px 10px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,.6);
    font-size: .85rem;
    transition: background .15s, color .15s;
}

.sidebar-footer a:hover { background: rgba(255,0,0,.15); color: #fc8181; }

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

/* ── Topbar ── */
.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-title { font-size: 1.1rem; font-weight: 600; color: var(--primary); }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .88rem;
    color: var(--gray);
}

.avatar {
    width: 34px;
    height: 34px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
}

/* ── Page Body ── */
.page-body { padding: 28px; }

/* ── Stats Cards ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg { width: 24px; height: 24px; }

.stat-icon.blue   { background: #dbeafe; color: var(--primary-light); }
.stat-icon.green  { background: #dcfce7; color: var(--green); }
.stat-icon.orange { background: #fef3c7; color: var(--orange); }
.stat-icon.red    { background: #fee2e2; color: var(--red); }

.stat-info { min-width: 0; }
.stat-num  { font-size: 1.7rem; font-weight: 700; color: #111827; line-height: 1; }
.stat-lbl  { font-size: .8rem; color: var(--gray); margin-top: 4px; }

/* ── Card ── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 24px;
}

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

.card-title { font-size: 1rem; font-weight: 600; color: var(--primary); }

.card-body { padding: 22px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}

thead th {
    padding: 11px 14px;
    text-align: left;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--gray);
    background: var(--gray-light);
    border-bottom: 1px solid var(--border);
}

tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:hover { background: #f9fafb; }
tbody tr:last-child { border-bottom: none; }

tbody td { padding: 12px 14px; vertical-align: middle; }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
}

.badge-green  { background: #dcfce7; color: #166534; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-gray   { background: #f3f4f6; color: #374151; }
.badge-orange { background: #fef3c7; color: #92400e; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: 7px;
    font-size: .85rem;
    font-weight: 500;
    font-family: var(--font);
    border: none;
    cursor: pointer;
    transition: opacity .15s;
}

.btn:hover { opacity: .88; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn svg { width: 16px; height: 16px; }

.btn-primary   { background: var(--primary); color: var(--white); }
.btn-accent    { background: var(--accent); color: var(--white); }
.btn-green     { background: var(--green); color: var(--white); }
.btn-red       { background: var(--red); color: var(--white); }
.btn-outline   { background: transparent; border: 1px solid var(--border); color: #374151; }
.btn-icon-only { padding: 6px; }

.btn-sm { padding: 5px 11px; font-size: .8rem; }

/* ── Forms ── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.form-group { margin-bottom: 0; }

.form-group label {
    display: block;
    font-size: .83rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    font-size: .9rem;
    font-family: var(--font);
    color: #1f2937;
    background: var(--white);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(26,90,154,.12);
}

.form-group textarea { resize: vertical; min-height: 90px; }

.form-group .hint { font-size: .78rem; color: var(--gray); margin-top: 4px; }

.form-actions {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ── Alerts ── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: .88rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert svg { width: 18px; height: 18px; flex-shrink: 0; }

.alert-success { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.alert-error   { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.alert-info    { background: #eff6ff; border: 1px solid #93c5fd; color: #1e40af; }

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: .83rem;
    border: 1px solid var(--border);
    color: #374151;
    transition: background .15s;
}

.pagination a:hover { background: var(--gray-light); text-decoration: none; }
.pagination .current { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* ── Search / Filter Bar ── */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-bar input,
.filter-bar select {
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    font-size: .88rem;
    font-family: var(--font);
    outline: none;
    transition: border-color .2s;
}

.filter-bar input:focus,
.filter-bar select:focus { border-color: var(--primary-light); }

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--gray);
}

.empty-state svg { width: 48px; height: 48px; margin: 0 auto 12px; display: block; opacity: .4; }
.empty-state h3  { font-size: 1rem; font-weight: 600; margin-bottom: 6px; color: #374151; }
.empty-state p   { font-size: .85rem; }

/* ── Responsive ── */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
}

@media (max-width: 600px) {
    .page-body { padding: 16px; }
    .topbar { padding: 12px 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
