/* ===== Admin Dashboard Styles ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', -apple-system, sans-serif; background: #f5f5f7; color: #1a1a1a; line-height: 1.5; }

/* ===== Login Gate ===== */
.login-gate {
    position: fixed; inset: 0; background: #111;
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}
.login-gate.hidden { display: none; }
.login-card {
    background: #fff; border-radius: 12px; padding: 3rem;
    width: 380px; max-width: 90vw; text-align: center;
}
.login-card h1 { font-size: 1.8rem; letter-spacing: .15em; margin-bottom: .3rem; }
.login-card > p { color: #888; font-size: .85rem; margin-bottom: 2rem; }
.login-card input {
    display: block; width: 100%; padding: .8rem 1rem; margin-bottom: .8rem;
    border: 1.5px solid #e0e0e0; border-radius: 6px; font-size: .9rem;
    font-family: inherit; outline: none; transition: border-color .2s;
}
.login-card input:focus { border-color: #1a1a1a; }
.login-card button[type="submit"] {
    width: 100%; padding: .85rem; background: #1a1a1a; color: #fff;
    border: none; border-radius: 6px; font-size: .9rem; font-weight: 600;
    cursor: pointer; font-family: inherit; letter-spacing: .03em;
    transition: background .2s;
}
.login-card button[type="submit"]:hover { background: #333; }
.login-error { color: #e53e3e; font-size: .8rem; margin-top: .5rem; min-height: 1.2rem; }
.demo-btn {
    margin-top: 1rem; background: none; border: 1.5px solid #ddd; padding: .7rem 1.5rem;
    border-radius: 6px; font-size: .8rem; color: #666; cursor: pointer;
    font-family: inherit; transition: all .2s;
}
.demo-btn:hover { border-color: #1a1a1a; color: #1a1a1a; }

/* ===== Dashboard Layout ===== */
.dashboard { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 240px; background: #fff; border-right: 1px solid #eee;
    display: flex; flex-direction: column; position: fixed;
    top: 0; left: 0; bottom: 0; z-index: 100;
}
.sidebar-logo {
    padding: 1.5rem; font-size: 1.2rem; font-weight: 700;
    letter-spacing: .15em; border-bottom: 1px solid #eee;
}
.sidebar-nav { flex: 1; padding: 1rem 0; }
.sidebar-nav a {
    display: flex; align-items: center; gap: .8rem;
    padding: .75rem 1.5rem; color: #666; font-size: .85rem;
    font-weight: 500; text-decoration: none; transition: all .2s;
}
.sidebar-nav a:hover { color: #1a1a1a; background: #f5f5f7; }
.sidebar-nav a.active { color: #1a1a1a; background: #f0f0f2; font-weight: 600; }
.sidebar-nav a svg { opacity: .6; }
.sidebar-nav a.active svg { opacity: 1; }
.sidebar-footer {
    padding: 1rem 1.5rem; border-top: 1px solid #eee;
    display: flex; flex-direction: column; gap: .5rem;
}
.sidebar-footer a, .sidebar-footer button {
    font-size: .8rem; color: #888; background: none; border: none;
    text-align: left; cursor: pointer; font-family: inherit;
    text-decoration: none; padding: .3rem 0; transition: color .2s;
}
.sidebar-footer a:hover, .sidebar-footer button:hover { color: #1a1a1a; }

/* Main Content */
.main-content { margin-left: 240px; flex: 1; padding: 2rem; }

/* Panels */
.panel { display: none; }
.panel.active { display: block; }
.panel h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 1.5rem; }
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.panel-header h1 { margin-bottom: 0; }

/* Stat Cards */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
    background: #fff; border-radius: 10px; padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.stat-label { font-size: .75rem; color: #888; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 1.8rem; font-weight: 700; margin: .3rem 0; }
.stat-change { font-size: .8rem; font-weight: 600; }
.stat-change.positive { color: #2d7d46; }
.stat-change.negative { color: #e53e3e; }

/* Chart Cards */
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 2rem; }
.chart-card {
    background: #fff; border-radius: 10px; padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.chart-card h3 { font-size: .9rem; font-weight: 600; margin-bottom: 1rem; }
.chart-card.half { }

/* Tables */
.table-card {
    background: #fff; border-radius: 10px; padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.04); overflow-x: auto;
}
.table-card h3 { font-size: .9rem; font-weight: 600; margin-bottom: 1rem; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: #888; padding: .8rem 1rem; border-bottom: 1px solid #eee; }
td { padding: .8rem 1rem; font-size: .85rem; border-bottom: 1px solid #f5f5f5; }
.full-table { background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.04); overflow: hidden; }

/* Status Badges */
.badge {
    display: inline-block; padding: .25rem .7rem; border-radius: 20px;
    font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
}
.badge-pending { background: #fef3cd; color: #856404; }
.badge-processing { background: #d1ecf1; color: #0c5460; }
.badge-shipped { background: #d4edda; color: #155724; }
.badge-delivered { background: #cce5ff; color: #004085; }

/* Filter Bar */
.filter-bar { display: flex; gap: .5rem; margin-bottom: 1rem; }
.filter-btn {
    padding: .5rem 1rem; border: 1.5px solid #e0e0e0; border-radius: 20px;
    font-size: .8rem; font-family: inherit; background: #fff; cursor: pointer;
    transition: all .2s;
}
.filter-btn:hover, .filter-btn.active { border-color: #1a1a1a; background: #1a1a1a; color: #fff; }

/* Buttons */
.btn-primary {
    padding: .7rem 1.5rem; background: #1a1a1a; color: #fff;
    border: none; border-radius: 6px; font-size: .85rem; font-weight: 600;
    cursor: pointer; font-family: inherit; transition: background .2s;
}
.btn-primary:hover { background: #333; }
.btn-sm {
    padding: .4rem .8rem; font-size: .75rem; border: 1px solid #ddd;
    border-radius: 4px; background: #fff; cursor: pointer; font-family: inherit;
    transition: all .2s;
}
.btn-sm:hover { border-color: #1a1a1a; }

/* Product thumbnail */
.prod-thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; }

/* Responsive */
@media (max-width: 1024px) {
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .chart-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-logo { font-size: 0; padding: 1rem; }
    .sidebar-logo::first-letter { font-size: 1.2rem; }
    .sidebar-nav a span, .sidebar-nav a { font-size: 0; justify-content: center; padding: .75rem; }
    .sidebar-nav a svg { opacity: 1; }
    .sidebar-footer { display: none; }
    .main-content { margin-left: 60px; padding: 1rem; }
    .stat-cards { grid-template-columns: 1fr 1fr; }
}

/* ===== CMS Content Editor ===== */
.cms-hint { font-size: .8rem; color: #888; margin: -.5rem 0 1.5rem; }
.cms-section {
    background: #fff; border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04); margin-bottom: 1rem; overflow: hidden;
}
.cms-section-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.5rem; cursor: pointer; user-select: none;
    border-bottom: 1px solid transparent; transition: border-color .2s;
}
.cms-section--open .cms-section-header { border-bottom-color: #eee; }
.cms-section-header h3 { font-size: .9rem; font-weight: 600; }
.cms-section-chevron { width: 18px; height: 18px; transition: transform .25s; opacity: .5; }
.cms-section--open .cms-section-chevron { transform: rotate(180deg); }
.cms-section-body { display: none; padding: 1.5rem; }
.cms-section--open .cms-section-body { display: block; }
.cms-sub-block {
    border: 1px solid #eee; border-radius: 8px; padding: 1rem; margin-bottom: .75rem;
}
.cms-sub-block-label {
    font-size: .7rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .08em; color: #888; margin-bottom: .75rem;
}
.cms-field { margin-bottom: 1rem; }
.cms-field label {
    display: block; font-size: .75rem; font-weight: 600; color: #555;
    margin-bottom: .35rem; letter-spacing: .03em;
}
.cms-field input[type="text"], .cms-field textarea {
    width: 100%; padding: .65rem .9rem; border: 1.5px solid #e0e0e0;
    border-radius: 6px; font-size: .85rem; font-family: 'Inter', sans-serif;
    outline: none; transition: border-color .2s; resize: vertical;
}
.cms-field input:focus, .cms-field textarea:focus { border-color: #1a1a1a; }
.cms-img-row { display: flex; align-items: center; gap: .75rem; }
.cms-img-row input { flex: 1; }
.cms-img-preview {
    width: 52px; height: 52px; border-radius: 6px; object-fit: cover;
    border: 1px solid #eee; flex-shrink: 0;
}
.cms-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.cms-section-footer {
    display: flex; justify-content: flex-end; gap: .75rem;
    padding-top: 1rem; margin-top: .5rem; border-top: 1px solid #f0f0f0;
}
.btn-cms-save {
    padding: .55rem 1.2rem; background: #1a1a1a; color: #fff; border: none;
    border-radius: 6px; font-size: .8rem; font-weight: 600; cursor: pointer;
    font-family: inherit; transition: background .2s;
}
.btn-cms-save:hover { background: #333; }
.btn-cms-reset {
    padding: .55rem 1.2rem; border: 1.5px solid #ddd; background: #fff;
    border-radius: 6px; font-size: .8rem; cursor: pointer;
    font-family: inherit; color: #666; transition: all .2s;
}
.btn-cms-reset:hover { border-color: #888; color: #1a1a1a; }
.cms-toast {
    position: fixed; bottom: 2rem; right: 2rem; background: #1a1a1a; color: #fff;
    padding: .8rem 1.4rem; border-radius: 8px; font-size: .85rem; font-weight: 500;
    z-index: 9999; opacity: 0; transform: translateY(8px);
    transition: opacity .25s, transform .25s; pointer-events: none;
    box-shadow: 0 4px 20px rgba(0,0,0,.2);
}
.cms-toast--visible { opacity: 1; transform: translateY(0); }

/* Upload Zones */
.cms-upload-zone {
    border: 2px dashed #ddd; border-radius: 8px; overflow: hidden;
    transition: border-color .2s, background .2s; position: relative;
    min-height: 120px;
}
.cms-upload-zone--dragover { border-color: #1a1a1a; background: #f8f8ff; }
.cms-upload-prompt {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .4rem; padding: 1.5rem; cursor: pointer; color: #888;
    min-height: 120px;
}
.cms-upload-prompt svg { opacity: .5; }
.cms-upload-prompt span { font-size: .8rem; }
.cms-upload-hint { font-size: .7rem !important; color: #bbb; }
.cms-upload-prompt:hover { color: #555; }
.cms-upload-prompt:hover svg { opacity: .8; }
.cms-upload-preview {
    position: relative; cursor: pointer;
}
.cms-upload-preview .cms-img-preview {
    width: 100%; max-height: 200px; object-fit: cover;
    border-radius: 6px; display: block;
}
.cms-remove-img {
    position: absolute; top: 6px; right: 6px;
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(0,0,0,.6); color: #fff; border: none;
    font-size: 1.1rem; cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    opacity: 0; transition: opacity .2s;
    line-height: 1;
}
.cms-upload-preview:hover .cms-remove-img { opacity: 1; }
.cms-upload-progress {
    padding: .75rem;
}
.cms-progress-bar {
    height: 4px; background: #1a1a1a; border-radius: 2px;
    width: 0; transition: width .3s ease;
}
