/* ============================================
   NAVCAN LIQUIDATION — Admin Dashboard Styles
   ============================================ */
:root {
    --sidebar: 250px;
    --dark: #1a1a2e;
    --darker: #16213e;
    --accent: #D32F2F;
    --accent-light: #ff6659;
    --bg: #f0f2f5;
    --card: #fff;
    --text: #333;
    --text-light: #888;
    --border: #e5e7eb;
    --radius: 10px;
    --shadow: 0 2px 12px rgba(0, 0, 0, .06);
    --tr: all .25s ease
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden
}

/* Login Gate */
.admin-login-gate {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--dark), var(--darker));
    padding: 20px
}

.admin-login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .3)
}

.admin-login-logo {
    width: 56px;
    height: 56px;
    margin-bottom: 16px
}

.admin-login-card h1 {
    font-size: 1.5rem;
    color: var(--dark);
    margin-bottom: 4px
}

.admin-login-card p {
    color: var(--text-light);
    font-size: .9rem;
    margin-bottom: 24px
}

.admin-login-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 10px;
    border-radius: 8px;
    font-size: .85rem;
    display: none;
    margin-bottom: 16px;
    border-left: 3px solid #dc2626
}

.admin-login-field {
    margin-bottom: 16px;
    text-align: left
}

.admin-login-field label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--dark)
}

.admin-login-field label i {
    color: var(--accent);
    margin-right: 4px
}

.admin-login-field input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: .95rem;
    transition: var(--tr)
}

.admin-login-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(211, 47, 47, .08)
}

.admin-login-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--tr);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
    background: var(--accent);
    color: #fff
}

.admin-login-btn:hover {
    background: #b71c1c
}

.admin-login-btn.google {
    background: #fff;
    color: var(--dark);
    border: 1.5px solid var(--border)
}

.admin-login-btn.google:hover {
    background: #f5f5f5
}

.back-link {
    color: var(--text-light);
    font-size: .85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    transition: var(--tr)
}

.back-link:hover {
    color: var(--accent)
}

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

/* Sidebar */
.admin-sidebar {
    width: var(--sidebar);
    background: var(--dark);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform .3s ease
}

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

.sidebar-logo {
    width: 36px;
    height: 36px
}

.sidebar-title {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 2px
}

.sidebar-sub {
    display: block;
    font-size: .65rem;
    color: rgba(255, 255, 255, .5);
    letter-spacing: 1px
}

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

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, .6);
    font-size: .9rem;
    font-weight: 500;
    transition: var(--tr);
    border-left: 3px solid transparent
}

.sidebar-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, .05)
}

.sidebar-link.active {
    color: #fff;
    background: rgba(211, 47, 47, .15);
    border-left-color: var(--accent)
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: .95rem
}

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

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: rgba(255, 255, 255, .5);
    font-size: .85rem;
    transition: var(--tr)
}

.sidebar-footer a:hover {
    color: #fff
}

/* Mobile Header */
.admin-mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--dark);
    color: #fff;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 101
}

.admin-menu-toggle,
.admin-mobile-logout {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px
}

.admin-mobile-title {
    font-weight: 700;
    font-size: 1rem
}

/* Main Content */
.admin-main {
    margin-left: var(--sidebar);
    flex: 1;
    padding: 24px;
    min-height: 100vh
}

/* Sections */
.admin-section {
    display: none
}

.admin-section.active {
    display: block
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px
}

.section-header h1 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px
}

.section-header h1 i {
    color: var(--accent);
    font-size: 1.2rem
}

.section-date {
    color: var(--text-light);
    font-size: .85rem
}

.section-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px
}

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

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff
}

.stat-icon.blue {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8)
}

.stat-icon.green {
    background: linear-gradient(135deg, #22c55e, #16a34a)
}

.stat-icon.orange {
    background: linear-gradient(135deg, #f59e0b, #d97706)
}

.stat-icon.red {
    background: linear-gradient(135deg, #ef4444, #dc2626)
}

.stat-num {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--dark)
}

.stat-label {
    display: block;
    font-size: .8rem;
    color: var(--text-light);
    margin-top: 2px
}

/* Dash Grid */
.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px
}

.dash-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow)
}

.dash-card h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px
}

.dash-card h3 i {
    color: var(--accent)
}

.dash-list {
    max-height: 300px;
    overflow-y: auto
}

.empty-state {
    text-align: center;
    color: var(--text-light);
    padding: 40px 0;
    font-size: .9rem
}

/* Table */
.admin-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap
}

.admin-search {
    position: relative;
    flex: 1;
    min-width: 200px
}

.admin-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light)
}

.admin-search input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: .9rem
}

.admin-search input:focus {
    border-color: var(--accent)
}

.admin-toolbar select {
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: .85rem;
    background: #fff
}

.product-count {
    color: var(--text-light);
    font-size: .85rem;
    white-space: nowrap
}

.admin-table-wrap {
    overflow-x: auto;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow)
}

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

.admin-table thead {
    background: #f8f9fa
}

.admin-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    color: var(--text-light);
    border-bottom: 1px solid var(--border);
    white-space: nowrap
}

.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle
}

.admin-table tbody tr:hover {
    background: #fafbfc
}

.admin-table img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    text-transform: capitalize
}

.status-badge.active,
.status-badge.delivered {
    background: #dcfce7;
    color: #16a34a
}

.status-badge.draft,
.status-badge.pending {
    background: #fef3c7;
    color: #d97706
}

.status-badge.confirmed,
.status-badge.shipped {
    background: #dbeafe;
    color: #2563eb
}

.status-badge.cancelled {
    background: #fef2f2;
    color: #dc2626
}

/* Buttons */
.admin-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--tr)
}

.admin-btn.primary {
    background: var(--accent);
    color: #fff
}

.admin-btn.primary:hover {
    background: #b71c1c
}

.admin-btn.outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text)
}

.admin-btn.outline:hover {
    border-color: var(--accent);
    color: var(--accent)
}

.admin-btn.sm {
    padding: 6px 12px;
    font-size: .8rem
}

.admin-btn.danger {
    background: #fee;
    color: #dc2626;
    border: 1px solid #fecaca
}

.admin-btn.danger:hover {
    background: #fecaca
}

.action-btns {
    display: flex;
    gap: 6px
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 16px;
    flex-wrap: wrap
}

.pagination button {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: .85rem;
    transition: var(--tr)
}

.pagination button.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent)
}

.pagination button:hover:not(.active) {
    background: #f5f5f5
}

/* Analytics */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px
}

.analytics-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow)
}

.analytics-card.full {
    grid-column: 1/-1
}

.analytics-card h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--dark)
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, .5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px
}

.modal-overlay.active {
    display: flex
}

.modal-content {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .2)
}

.modal-content.wide {
    max-width: 700px
}

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

.modal-header h2 {
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 8px
}

.modal-header h2 i {
    color: var(--accent)
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--tr)
}

.modal-close:hover {
    background: #eee;
    color: var(--accent)
}

.modal-body {
    padding: 24px
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px
}

.form-group {
    margin-bottom: 16px
}

.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--dark)
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: .9rem;
    transition: var(--tr);
    font-family: inherit
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(211, 47, 47, .08)
}

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

.form-row.three {
    grid-template-columns: 1fr 1fr 1fr
}

/* Order detail */
.order-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px
}

.order-detail-section h4 {
    font-size: .9rem;
    color: var(--accent);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px
}

.order-detail-section p {
    font-size: .9rem;
    margin-bottom: 4px
}

.order-items-list {
    margin-top: 16px
}

.order-items-list table {
    width: 100%
}

.order-items-list td {
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6
}

/* Image Upload Grid */
.image-upload-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px
}

.image-upload-slot {
    position: relative;
    aspect-ratio: 1;
    border: 2px dashed var(--border);
    border-radius: 10px;
    cursor: pointer;
    overflow: hidden;
    transition: var(--tr);
    background: #fafbfc
}

.image-upload-slot:hover {
    border-color: var(--accent);
    background: #fff5f5
}

.image-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2
}

.image-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 4px;
    color: var(--text-light);
    font-size: .75rem
}

.image-upload-placeholder i {
    font-size: 1.2rem;
    color: var(--accent);
    opacity: .6
}

.image-upload-preview {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1
}

.image-upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px
}

.image-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: .65rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    transition: var(--tr)
}

.image-remove-btn:hover {
    background: var(--accent)
}

/* Responsive */
@media(max-width:1024px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr
    }

    .dash-grid,
    .analytics-grid {
        grid-template-columns: 1fr
    }

    .image-upload-grid {
        grid-template-columns: repeat(3, 1fr)
    }
}

@media(max-width:768px) {
    .admin-sidebar {
        transform: translateX(-100%)
    }

    .admin-sidebar.open {
        transform: translateX(0)
    }

    .admin-mobile-header {
        display: flex
    }

    .admin-main {
        margin-left: 0;
        padding: 72px 12px 16px;
        overflow-x: hidden;
        max-width: 100vw
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr
    }

    .form-row {
        grid-template-columns: 1fr
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start
    }

    .section-header h1 {
        font-size: 1.2rem
    }

    .section-actions {
        width: 100%
    }

    .section-actions .admin-btn {
        flex: 1;
        justify-content: center;
        font-size: .8rem;
        padding: 8px 12px
    }

    .order-detail-grid {
        grid-template-columns: 1fr
    }

    /* Admin toolbar stacks */
    .admin-toolbar {
        flex-direction: column;
        align-items: stretch
    }

    .admin-search {
        min-width: unset;
        width: 100%
    }

    .admin-toolbar select {
        width: 100%
    }

    .product-count {
        text-align: center
    }

    /* Table responsive — card layout on mobile */
    .admin-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%
    }

    .admin-table {
        font-size: .8rem;
        min-width: 600px
    }

    .admin-table th,
    .admin-table td {
        padding: 8px 10px
    }

    .admin-table img {
        width: 36px;
        height: 36px
    }

    /* Modal fits mobile */
    .modal-overlay {
        padding: 10px;
        align-items: flex-start;
        padding-top: 60px
    }

    .modal-content {
        max-width: 100%;
        max-height: 85vh;
        border-radius: 12px
    }

    .modal-header {
        padding: 14px 16px
    }

    .modal-header h2 {
        font-size: 1rem
    }

    .modal-body {
        padding: 16px
    }

    .modal-footer {
        padding: 12px 16px
    }

    .image-upload-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px
    }

    .form-row.three {
        grid-template-columns: 1fr
    }
}

@media(max-width:480px) {
    .stats-grid {
        grid-template-columns: 1fr
    }

    .admin-main {
        padding: 64px 8px 12px
    }

    .admin-table {
        font-size: .75rem;
        min-width: 500px
    }

    .admin-table th,
    .admin-table td {
        padding: 6px 8px
    }

    .image-upload-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px
    }

    .stat-card {
        padding: 14px
    }

    .stat-num {
        font-size: 1.2rem
    }

    .admin-btn {
        font-size: .8rem;
        padding: 8px 12px
    }

    .dash-card {
        padding: 14px
    }
}