/* ============================================================
   SolarShop — Admin Panel Stylesheet
   ============================================================ */

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

:root {
    --primary:    #f59e0b;
    --primary-dk: #d97706;
    --primary-lt: #fef3c7;
    --dark:       #1c1917;
    --body:       #44403c;
    --muted:      #78716c;
    --border:     #e7e5e4;
    --bg:         #fafaf9;
    --white:      #ffffff;
    --sidebar-w:  240px;
    --radius:     8px;
    --shadow:     0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
    --font:       'Inter', system-ui, sans-serif;
}

body { font-family: var(--font); color: var(--body); background: var(--bg); line-height: 1.6; font-size: .9rem; }
a { color: var(--primary-dk); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ---- Login ---- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--dark); }
.login-wrap { width: 100%; max-width: 400px; padding: 20px; }
.login-box { background: var(--white); border-radius: 14px; padding: 36px; box-shadow: 0 8px 40px rgba(0,0,0,.25); }
.login-logo { font-size: 1.5rem; font-weight: 700; color: var(--dark); margin-bottom: 8px; }
.login-box h2 { font-size: 1.2rem; font-weight: 600; margin-bottom: 24px; color: var(--muted); }
.login-hint { font-size: .8rem; color: var(--muted); margin-top: 12px; }
.back-link { display: block; text-align: center; margin-top: 16px; font-size: .85rem; color: var(--muted); }

/* ---- Layout ---- */
.admin-wrap { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--dark); color: #c2bfbb; display: flex; flex-direction: column; flex-shrink: 0; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 200; transition: transform .25s; }
.sidebar-logo { padding: 20px 20px 16px; border-bottom: 1px solid #292524; }
.sidebar-logo a { font-size: 1.1rem; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; }
.sidebar-logo a:hover { text-decoration: none; }
.sidebar-badge { font-size: .65rem; background: var(--primary); color: #fff; padding: 2px 6px; border-radius: 4px; margin-left: auto; }
.sidebar-nav { padding: 12px 0; }
.sidebar-nav a { display: block; padding: 10px 20px; color: #a8a29e; font-size: .875rem; font-weight: 500; transition: all .15s; }
.sidebar-nav a:hover { color: #fff; background: rgba(255,255,255,.06); text-decoration: none; }
.sidebar-nav a.active { color: #fff; background: rgba(245,158,11,.15); border-left: 3px solid var(--primary); }
.sidebar-divider { border-top: 1px solid #292524; margin: 8px 0; }
.logout-link { color: #ef4444 !important; }

.admin-main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.admin-topbar { background: var(--white); border-bottom: 1px solid var(--border); padding: 0 24px; height: 56px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.sidebar-toggle { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--body); }
.admin-topbar-right { display: flex; align-items: center; gap: 16px; font-size: .875rem; }
.admin-content { padding: 28px 28px 48px; }

/* ---- Page Header ---- */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--dark); }

/* ---- Stats Cards ---- */
.stats-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 20px; display: flex; align-items: center; gap: 16px; }
.stat-icon { font-size: 2rem; }
.stat-body strong { display: block; font-size: 1.5rem; font-weight: 700; color: var(--dark); }
.stat-body span { font-size: .8rem; color: var(--muted); }
.stat-blue  { border-top: 3px solid #3b82f6; }
.stat-green { border-top: 3px solid #22c55e; }
.stat-yellow { border-top: 3px solid var(--primary); }
.stat-purple { border-top: 3px solid #a855f7; }

/* ---- Dashboard grid ---- */
.dashboard-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; }
.dash-panel { background: var(--white); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.panel-header h3 { font-size: 1rem; font-weight: 700; }
.panel-header a { font-size: .82rem; color: var(--primary-dk); }
.empty-msg { padding: 24px 20px; color: var(--muted); font-size: .875rem; }

/* ---- Admin Tables ---- */
.admin-table-wrap { background: var(--white); border: 1px solid var(--border); border-radius: 12px; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.admin-table thead tr { background: var(--bg); }
.admin-table th { padding: 10px 14px; text-align: left; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: #fafaf9; }
.empty-cell { text-align: center; color: var(--muted); padding: 32px !important; }
.text-right { text-align: right !important; }
.total-row td { font-weight: 700; font-size: 1rem; background: var(--bg); }
.table-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.table-thumb-placeholder { width: 48px; height: 48px; background: var(--primary-lt); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.action-cell { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---- Status badges ---- */
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .75rem; font-weight: 600; }
.status-pending    { background: #fef9c3; color: #854d0e; }
.status-confirmed  { background: #dbeafe; color: #1e40af; }
.status-processing { background: #ede9fe; color: #5b21b6; }
.status-shipped    { background: #cffafe; color: #155e75; }
.status-delivered  { background: #dcfce7; color: #166534; }
.status-cancelled  { background: #fee2e2; color: #991b1b; }
.status-active     { background: #dcfce7; color: #166534; }
.status-inactive   { background: #f3f4f6; color: #6b7280; }
.status-paid       { background: #dcfce7; color: #166534; }
.status-failed     { background: #fee2e2; color: #991b1b; }
.status-refunded   { background: #ede9fe; color: #5b21b6; }

/* ---- Filter bar ---- */
.filter-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.filter-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-form input, .filter-form select { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: .875rem; background: var(--white); }
.filter-bar p { font-size: .82rem; color: var(--muted); }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: var(--radius); font-size: .875rem; font-weight: 600; cursor: pointer; border: none; transition: all .15s; font-family: var(--font); text-decoration: none; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dk); }
.btn-outline { background: transparent; color: var(--primary-dk); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-lt); }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 5px 10px; font-size: .78rem; }
.btn-lg { padding: 12px 24px; font-size: .95rem; }
.btn-block { width: 100%; display: flex; }

/* ---- Forms ---- */
.admin-form {}
.form-layout { display: flex; gap: 24px; align-items: flex-start; }
.form-main { flex: 1; min-width: 0; }
.form-sidebar { width: 300px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; }
.form-card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 20px; }
.form-card h3 { font-size: .95rem; font-weight: 700; margin-bottom: 16px; color: var(--dark); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }
.form-group label { display: block; font-size: .8rem; font-weight: 600; color: var(--dark); margin-bottom: 5px; }
.form-group small { display: block; font-size: .75rem; color: var(--muted); margin-top: 4px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius); font-size: .875rem; font-family: var(--font); background: var(--white); transition: border-color .15s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(245,158,11,.12); }
.help-text { font-size: .8rem; color: var(--muted); margin-bottom: 12px; }
.toggle-label { display: flex; align-items: center; gap: 8px; font-size: .875rem; cursor: pointer; margin-bottom: 10px; }
.toggle-label input[type="checkbox"] { width: 16px; height: 16px; }

/* ---- Specs row ---- */
.spec-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.spec-row input { flex: 1; }

/* ---- Order detail ---- */
.order-detail-layout { display: grid; grid-template-columns: 1fr 280px; gap: 24px; align-items: start; }
.order-main {}
.order-sidebar { display: flex; flex-direction: column; gap: 16px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-grid strong { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 4px; }
.detail-grid p { font-size: .9rem; }
.confirm-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .875rem; }
.confirm-row:last-child { border: none; }

/* ---- Gallery Upload Preview ---- */
.gallery-preview-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.gallery-thumb-preview {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid var(--border);
}

/* ---- Gallery Manage Grid (edit page) ---- */
.gallery-manage-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 4px;
}
.gallery-manage-item label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.gallery-manage-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid var(--border);
    transition: border-color .15s;
}
.gallery-manage-item label:hover img { border-color: var(--primary); }
.gallery-manage-check {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: .75rem;
    color: var(--muted);
}
.gallery-manage-item input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--primary); }

/* ---- Alerts ---- */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; font-size: .875rem; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-error ul { padding-left: 18px; }

/* ---- Pagination ---- */
.pagination { display: flex; gap: 6px; margin-top: 20px; }
.page-link { padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: .82rem; color: var(--body); }
.page-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-link:hover { background: var(--bg); text-decoration: none; }

/* ---- Responsive ---- */
@media (max-width: 1100px) {
    .stats-cards { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .form-layout { flex-direction: column; }
    .form-sidebar { width: 100%; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .order-detail-layout { grid-template-columns: 1fr; }
    .stats-cards { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .stats-cards { grid-template-columns: 1fr; }
    .admin-content { padding: 16px; }
}
