/* ADMIN DASHBOARD - BOSS MODE STYLES */

/* Metal Mania - Local */
@font-face {
    font-family: "Metal Mania";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    /* Updated to v23 and absolute path */
    src: url("/assets/fonts/metal-mania-v23-latin-regular.woff2")
        format("woff2");
}

/* Inter - Local */
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    /* Updated to v20 and absolute path */
    src: url("/assets/fonts/inter-v20-latin-regular.woff2") format("woff2");
}
:root {
    --bg-dark: #09090b;
    --bg-card: #121214;
    --border-color: #27272a;
    --primary: #ff6600;
    --primary-hover: #ff8533;
    --text-main: #ffffff;
    --text-muted: #a1a1aa;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;

    --sidebar-width: 260px;
    --mobile-breakpoint: 768px;
    --ham-btn-size: 52px;
    --bottom-sheet-height: 70vh;
}
* {
    font-family: "Inter" !important;
}
.fas,
.far,
.fab,
.fa,
.fa-solid,
.fa-regular,
.fa-brands {
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900;
}
.far,
.fa-regular {
    font-weight: 400;
}
body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: "Inter", sans-serif !important;
    margin: 0;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* SIDEBAR */
.sidebar {
    width: 260px;
    background: var(--bg-card);
    height: 100vh;
    border-right: 1px solid var(--border-color);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar h2 {
    color: var(--primary);
    font-family: "Oswald", sans-serif;
    text-transform: uppercase;
    margin: 0 0 40px 10px;
    font-size: 24px;
    letter-spacing: 1px;
}

.menu-link {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    padding: 12px 15px;
    text-decoration: none;
    font-weight: 500;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    font-size: 14px;
}

.menu-link:hover {
    background: rgba(255, 102, 0, 0.1);
    color: var(--primary);
}

.menu-link.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.3);
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto; /* Scroll inside content area */
    background: radial-gradient(circle at top right, #1a1a1a 0%, #09090b 40%);
}

h1 {
    font-family: "Oswald", sans-serif;
    font-size: 32px;
    margin-bottom: 30px;
    text-transform: uppercase;
}

/* CARDS (Stats) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    padding: 25px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: transform 0.2s;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.stat-card h3 {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

.stat-card p {
    font-size: 28px;
    font-weight: 700;
    color: white;
    margin: 10px 0 0 0;
    font-family: "Oswald", sans-serif;
}

/* TABLES */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

th {
    background: #18181b;
    padding: 18px;
    text-align: left;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 18px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: #e4e4e7;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}
tr:hover td {
    background: #1c1c1f;
}

img.thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

/* FORMS */
.admin-form {
    background: var(--bg-card);
    padding: 30px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-width: 600px;
    margin-bottom: 30px;
}

input,
textarea,
select {
    width: 100%;
    padding: 12px;
    background: #000;
    border: 1px solid var(--border-color);
    color: white;
    margin-bottom: 20px;
    border-radius: 6px;
    font-family: "Inter", sans-serif;
    transition: 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(255, 102, 0, 0.2);
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

/* BUTTONS */
.btn-admin {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    cursor: pointer;
    font-weight: 600;
    border-radius: 6px;
    text-transform: uppercase;
    font-size: 13px;
    transition: 0.2s;
    display: inline-block;
}

.btn-admin:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-edit,
.btn-delete,
.btn-print {
    padding: 6px 12px;
    text-decoration: none;
    font-size: 11px;
    border-radius: 4px;
    font-weight: 600;
    display: inline-block;
    border: 1px solid transparent;
}

.btn-edit {
    background: #27272a;
    color: white;
    border-color: #3f3f46;
}
.btn-edit:hover {
    border-color: var(--text-muted);
}

.btn-delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}
.btn-delete:hover {
    background: var(--danger);
    color: white;
}

.btn-print {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.2);
    margin-left: 5px;
}
.btn-print:hover {
    background: var(--success);
    color: white;
}

/* UTILS */
.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}
.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}
.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Hide mobile-only elements on desktop */
.ham-btn,
.sheet-backdrop,
.bottom-sheet {
    display: none;
}

/* ============================================ */
/* MOBILE STYLES (≤ 768px)                      */
/* ============================================ */
@media (max-width: 768px) {
    /* Hide desktop sidebar on mobile */
    .sidebar {
        display: none !important;
    }

    /* Main content takes full width */
    .main-content {
        padding: 16px !important;
        padding-bottom: 90px !important;
        width: 100% !important;
        overflow-x: auto;
    }

    /* Compact headings */
    h1 {
        font-size: 22px !important;
        margin-bottom: 16px !important;
    }

    /* Date row stacks */
    .main-content > div:first-of-type {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }

    /* ======================================== */
    /* HAMBURGER BUTTON (fixed bottom-right)    */
    /* ======================================== */
    .ham-btn {
        display: flex !important;
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: var(--ham-btn-size);
        height: var(--ham-btn-size);
        background: var(--primary);
        color: white;
        border: none;
        border-radius: 50%;
        font-size: 24px;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 1100;
        box-shadow: 0 4px 20px rgba(255, 102, 0, 0.4);
        transition:
            transform 0.2s,
            box-shadow 0.2s;
        -webkit-tap-highlight-color: transparent;
    }
    .ham-btn:active {
        transform: scale(0.92);
    }

    /* ======================================== */
    /* BOTTOM SHEET BACKDROP                    */
    /* ======================================== */
    .sheet-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 1050;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    .sheet-backdrop.open {
        display: block;
        opacity: 1;
    }

    /* ======================================== */
    /* BOTTOM SHEET PANEL                       */
    /* ======================================== */
    .bottom-sheet {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: var(--bottom-sheet-height);
        background: var(--bg-card);
        border-radius: 20px 20px 0 0;
        z-index: 1060;
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5);
    }
    .bottom-sheet.open {
        transform: translateY(0);
    }

    /* Drag handle pill */
    .sheet-handle {
        width: 40px;
        height: 5px;
        background: #444;
        border-radius: 3px;
        margin: 12px auto 8px;
        flex-shrink: 0;
    }

    /* Sheet header row */
    .sheet-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 20px 16px;
        border-bottom: 1px solid var(--border-color);
        flex-shrink: 0;
    }
    .sheet-header h2 {
        color: var(--primary);
        font-family: "Oswald", sans-serif;
        text-transform: uppercase;
        margin: 0;
        font-size: 20px;
        letter-spacing: 1px;
    }
    .sheet-close {
        background: none;
        border: none;
        color: #888;
        font-size: 22px;
        cursor: pointer;
        padding: 8px;
        -webkit-tap-highlight-color: transparent;
    }

    /* Sheet nav links */
    .sheet-nav {
        flex: 1;
        overflow-y: auto;
        padding: 12px 12px 24px;
    }
    .sheet-link {
        display: flex;
        align-items: center;
        gap: 14px;
        color: var(--text-muted);
        padding: 15px 18px;
        text-decoration: none;
        font-weight: 500;
        border-radius: 10px;
        margin-bottom: 4px;
        font-size: 15px;
        transition: all 0.15s ease;
        -webkit-tap-highlight-color: transparent;
    }
    .sheet-link:hover,
    .sheet-link:active {
        background: rgba(255, 102, 0, 0.1);
        color: var(--primary);
    }
    .sheet-link.active {
        background: var(--primary);
        color: white;
        font-weight: 700;
        box-shadow: 0 4px 12px rgba(255, 102, 0, 0.3);
    }
    .sheet-link .sheet-icon {
        font-size: 18px;
        width: 24px;
        text-align: center;
        flex-shrink: 0;
    }

    /* Sheet separator */
    .sheet-divider {
        border-top: 1px solid var(--border-color);
        margin: 12px 12px;
    }

    /* Logout link in sheet */
    .sheet-link.logout-link {
        color: var(--danger);
    }

    /* Stats grid: single column on mobile */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        margin-bottom: 24px !important;
    }

    .stat-card {
        padding: 18px !important;
    }

    .stat-card p {
        font-size: 24px !important;
    }

    /* ======================================== */
    /* TABLE → CARD TRANSFORMATION              */
    /* ======================================== */
    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block !important;
    }

    /* Hide table header row */
    thead tr {
        display: none !important;
    }

    /* Each row becomes a card */
    tbody tr {
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        margin-bottom: 14px;
        padding: 8px;
    }

    tbody tr:hover {
        background: var(--bg-card);
    }

    /* Cells stack vertically */
    td {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        padding: 10px 14px !important;
        border-bottom: 1px solid rgba(39, 39, 42, 0.5);
        font-size: 13px !important;
        text-align: left;
        gap: 6px;
        word-break: break-word;
    }

    td:last-child {
        border-bottom: none;
    }

    /* Label from data-label attribute */
    td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--primary);
        text-transform: uppercase;
        font-size: 10px;
        letter-spacing: 0.5px;
        margin-bottom: 6px;
    }

    /* Override for table-overridden styles */
    table {
        background: transparent;
        border: none;
        border-radius: 0;
        border-collapse: separate;
    }

    /* ======================================== */
    /* TOUCH-FRIENDLY BUTTONS                   */
    /* ======================================== */
    .btn-edit,
    .btn-delete,
    .btn-print,
    .btn-admin,
    .btn-copy-info,
    button[type="submit"] {
        min-height: 44px !important;
        min-width: 44px !important;
        font-size: 13px !important;
        padding: 10px 16px !important;
    }

    /* Ensure delete button contrast is visible on dark mobile backgrounds */
    .btn-delete {
        background: rgba(239, 68, 68, 0.15) !important;
        padding: 10px 16px !important;
    }

    /* Bulk action form - flexible wrapping on mobile */
    #bulk-form {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    /* Action button groups - column stack for product cards */
    .action-group {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        align-items: stretch !important;
        width: 100% !important;
    }

    .action-cell {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        width: 100% !important;
        gap: 10px !important;
    }

    .action-cell .btn-edit,
    .action-cell .btn-delete,
    .action-cell .btn-print,
    .action-cell .btn-copy-info {
        box-sizing: border-box !important;
    }

    /* Prevent standalone action buttons from stretching full width */
    .btn-edit:not(.action-cell .btn-edit) {
        width: auto !important;
        max-width: max-content !important;
    }

    /* IG POST button - override inline width, make full-width on mobile */
    .btn-insta {
        width: 100% !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Inner wrapper for edit/delete button pair inside action-group */
    .action-group > div {
        display: flex !important;
        flex-direction: row !important;
        width: 100% !important;
        gap: 8px !important;
    }

    .action-group > div .btn-edit,
    .action-group > div .btn-delete {
        flex: 1 !important;
        min-height: 44px !important;
    }

    /* Prevent iOS zoom on input focus */
    input,
    textarea,
    select {
        font-size: 16px !important;
    }

    /* ======================================== */
    /* RESPONSIVE MODALS                        */
    /* ======================================== */
    .modal-overlay {
        align-items: flex-end !important; /* Slide up from bottom on mobile */
    }

    .modal-content {
        max-width: 100% !important;
        width: 100% !important;
        max-height: 85vh !important;
        border-radius: 16px 16px 0 0 !important;
        padding: 20px !important;
    }

    .pagination {
        flex-wrap: wrap !important;
        gap: 6px !important;
    }

    .pagination a {
        min-width: 40px !important;
        min-height: 40px !important;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #salesChart {
        max-height: 220px !important;
    }

    /* Filter bar stacks vertically */
    .filter-bar {
        flex-direction: column !important;
        gap: 8px !important;
        padding: 12px !important;
    }

    .filter-input {
        width: 100% !important;
        box-sizing: border-box;
    }

    .filter-btn {
        width: 100% !important;
    }

    .tracking-input {
        width: 100% !important;
        box-sizing: border-box;
    }

    select[name="status"] {
        width: 100% !important;
    }

    .tab-bar {
        flex-wrap: wrap !important;
        gap: 0 !important;
    }

    .tab {
        font-size: 12px !important;
        padding: 12px 8px !important;
        white-space: nowrap;
    }

    /* ======================================== */
    /* PRODUCT THUMBNAILS                        */
    /* ======================================== */
    td[data-label="Image"] img.thumb {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 1 / 1;
        object-fit: contain !important;
        border-radius: 8px;
        background: #1c1c1f !important;
        border: 1px solid #3f3f46;
    }

    /* ======================================== */
    /* ROW SELECTION CHECKBOX INLINE             */
    /* ======================================== */
    tbody tr td:first-child {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 10px !important;
    }
    tbody tr td:first-child::before {
        content: "Select Item";
        margin-bottom: 0 !important;
        font-weight: 600;
        color: var(--text-muted, #a1a1aa);
        text-transform: uppercase;
        font-size: 10px;
        letter-spacing: 0.5px;
        flex-shrink: 0;
        white-space: nowrap;
    }
    tbody tr td:first-child input[type="checkbox"] {
        width: auto !important;
        min-width: 0 !important;
        max-width: 18px;
        height: 18px;
        margin: 0 !important;
        flex-shrink: 0;
        accent-color: var(--primary);
        cursor: pointer;
    }
}
