/* ==============================================================================
   Mizoram.Shop — Modern & Fully Mobile-Friendly Admin Portal Stylesheet
   Rooted in Traditional Mizo Palette & Responsive Design
   ============================================================================== */

:root {
    --adm-primary: #9f1239;           /* Traditional Mizo Crimson */
    --adm-primary-hover: #881337;     /* Deep Maroon */
    --adm-primary-light: #ffe4e6;
    --adm-accent: #d97706;            /* Mizo Gold */
    --adm-sidebar-bg: #111827;        /* Obsidian Charcoal */
    --adm-sidebar-text: #9ca3af;
    --adm-sidebar-active: #ffffff;
    --adm-sidebar-active-bg: rgba(159, 18, 57, 0.35);
    
    --adm-bg: #fdfbf7;
    --adm-surface: #ffffff;
    --adm-border: #e8e0d5;
    --adm-text: #1f2937;
    --adm-muted: #6b7280;
    --adm-heading: #111827;

    --adm-radius-sm: 6px;
    --adm-radius-md: 10px;
    --adm-radius-lg: 16px;

    --adm-shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --adm-shadow-md: 0 4px 14px rgba(159, 18, 57, 0.08);
}

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

body.admin-body {
    margin: 0;
    padding: 0;
    font-family: "Plus Jakarta Sans", "Outfit", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background-color: var(--adm-bg);
    color: var(--adm-text);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Admin Layout & Mobile Drawer ─────────────────────────────────────────── */
.admin-sidebar {
    width: 260px;
    background: var(--adm-sidebar-bg);
    color: var(--adm-sidebar-text);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 2px solid var(--adm-primary);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s;
    z-index: 1100;
}

.admin-sidebar-brand {
    padding: 20px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.admin-sidebar-brand img {
    height: 30px;
    width: auto;
}

.admin-sidebar-brand h2 {
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
    margin: 0;
}

.admin-sidebar-brand h2 span {
    color: var(--adm-accent);
}

.admin-sidebar-close {
    display: none;
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--adm-radius-sm);
    transition: color 0.15s ease;
}

.admin-sidebar-close:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.1);
}

.admin-nav {
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.admin-nav-heading {
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--adm-accent);
    padding: 10px 12px 4px;
    letter-spacing: 0.5px;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--adm-radius-sm);
    color: var(--adm-sidebar-text);
    font-weight: 700;
    font-size: 13.5px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.admin-nav-item:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.08);
}

.admin-nav-item.active {
    color: #ffffff;
    background: var(--adm-primary);
}

.admin-nav-item .material-icons {
    font-size: 19px;
}

.admin-sidebar-user {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-main-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
}

.admin-topbar {
    background: var(--adm-surface);
    border-bottom: 2px solid var(--adm-primary);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}

.admin-sidebar-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--adm-heading);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    line-height: 1;
    align-items: center;
    justify-content: center;
}

.admin-sidebar-toggle:hover {
    background: #f1f5f9;
}

.admin-sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 1090;
    display: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.admin-sidebar-backdrop.show {
    display: block;
    opacity: 1;
}

.admin-content {
    padding: 24px;
    flex: 1;
    min-width: 0;
}

/* ── KPI Stat Cards ────────────────────────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-top: 3px solid var(--adm-primary);
    border-radius: var(--adm-radius-md);
    padding: 18px;
    box-shadow: var(--adm-shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.kpi-label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--adm-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.kpi-value {
    font-size: 22px;
    font-weight: 900;
    color: var(--adm-heading);
    line-height: 1.1;
}

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--adm-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon.teal { background: #ffe4e6; color: var(--adm-primary); }
.kpi-icon.blue { background: #e0f2fe; color: #0369a1; }
.kpi-icon.amber { background: #fef3c7; color: var(--adm-accent); }
.kpi-icon.purple { background: #ede9fe; color: #6d28d9; }

/* ── Tables & Panels ───────────────────────────────────────────────────────── */
.admin-card {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius-md);
    box-shadow: var(--adm-shadow-sm);
    margin-bottom: 20px;
    overflow: hidden;
}

.admin-card-header {
    padding: 14px 18px;
    border-bottom: 1.5px solid var(--adm-border);
    background: #faf5ef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-card-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
    color: var(--adm-heading);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    text-align: left;
}

.admin-table th {
    background: #faf5ef;
    color: var(--adm-heading);
    font-weight: 800;
    padding: 11px 14px;
    border-bottom: 1px solid var(--adm-border);
    white-space: nowrap;
    font-size: 12.5px;
}

.admin-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--adm-border);
    color: var(--adm-text);
    vertical-align: middle;
}

.admin-table tr:hover td {
    background: #fdfbf7;
}

/* ── Status Badges ─────────────────────────────────────────────────────────── */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-status.pending { background: #fef3c7; color: #b45309; }
.badge-status.confirmed { background: #e0f2fe; color: #0369a1; }
.badge-status.processing { background: #ede9fe; color: #6d28d9; }
.badge-status.shipped { background: #dbeafe; color: #1e40af; }
.badge-status.delivered { background: #ecfdf5; color: #047857; }
.badge-status.cancelled { background: #fee2e2; color: #b91c1c; }
.badge-status.active { background: #ecfdf5; color: #047857; }
.badge-status.inactive { background: #f1f5f9; color: #64748b; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn-adm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--adm-radius-sm);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: all 0.15s ease;
    white-space: nowrap;
    touch-action: manipulation;
}

.btn-adm-primary {
    background: var(--adm-primary);
    color: #ffffff;
}

.btn-adm-primary:hover {
    background: var(--adm-primary-hover);
    color: #fff;
}

.btn-adm-secondary {
    background: #ffffff;
    color: var(--adm-text);
    border: 1px solid var(--adm-border);
}

.btn-adm-secondary:hover {
    background: #faf5ef;
    border-color: var(--adm-primary);
    color: var(--adm-primary);
}

.btn-adm-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.btn-adm-danger:hover {
    background: #fecaca;
}

.btn-adm-sm {
    padding: 5px 10px;
    font-size: 12px;
    min-height: 30px;
}

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.admin-form-group {
    margin-bottom: 14px;
}

.admin-form-group label {
    display: block;
    font-weight: 700;
    font-size: 13px;
    color: #374151;
    margin-bottom: 5px;
}

.admin-form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--adm-border);
    border-radius: var(--adm-radius-sm);
    font-family: inherit;
    font-size: 14px;
    background: #ffffff;
    color: var(--adm-heading);
    -webkit-appearance: none;
}

.admin-form-control:focus {
    border-color: var(--adm-primary);
    box-shadow: 0 0 0 3px rgba(159, 18, 57, 0.15);
    outline: none;
}

/* ── Modal Popups ──────────────────────────────────────────────────────────── */
.adm-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(17, 24, 39, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px 14px;
    opacity: 0;
    overflow-y: auto;
    transition: opacity 0.2s ease-in-out;
}

.adm-modal-backdrop.show {
    display: flex;
    opacity: 1;
}

.adm-modal-dialog {
    background: #ffffff;
    border-radius: var(--adm-radius-lg);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 580px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    transform: translateY(-15px) scale(0.98);
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid var(--adm-border);
    margin: auto;
    flex-shrink: 0;
    overflow: hidden;
}

.adm-modal-dialog form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.adm-modal-backdrop.show .adm-modal-dialog {
    transform: translateY(0) scale(1);
}

.adm-modal-dialog-lg {
    max-width: 860px;
}

.adm-modal-header {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--adm-border);
    background: #faf7f2;
    flex-shrink: 0;
}

.adm-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: var(--adm-heading);
    display: flex;
    align-items: center;
    gap: 8px;
}

.adm-modal-close {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--adm-radius-sm);
    transition: all 0.15s ease;
}

.adm-modal-close:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.adm-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.adm-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--adm-border);
    background: #faf7f2;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* ── Sequence Move Controls ────────────────────────────────────────────────── */
.seq-control-group {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.seq-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #334155;
    font-weight: 800;
    font-size: 11.5px;
    min-width: 26px;
    height: 26px;
    padding: 0 6px;
    border-radius: 5px;
    border: 1px solid #e2e8f0;
}

.btn-adm-move {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 5px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-adm-move:hover:not(.disabled) {
    background: var(--adm-primary-light);
    color: var(--adm-primary);
    border-color: var(--adm-primary);
}

.btn-adm-move.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-adm-move .material-icons {
    font-size: 16px;
}

/* ── Product Upload Card & Collapsible Options ────────────────────────────── */
.product-upload-card {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 16px;
    background: #f8fafc;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    user-select: none;
}

.product-upload-card:hover {
    border-color: var(--adm-primary);
    background: #fffdfa;
}

.btn-toggle-more {
    width: 100%;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 10px 14px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
    margin: 8px 0 12px 0;
}

.btn-toggle-more:hover {
    background: #e2e8f0;
    color: var(--adm-heading);
}

.collapsible-more-body {
    background: #faf7f2;
    border: 1px solid #e8e0d5;
    border-radius: 10px;
    padding: 16px 14px;
    margin-bottom: 12px;
}

/* ── Comprehensive Mobile & Tablet Responsiveness ──────────────────────────── */
@media (max-width: 991px) {
    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 82vw;
        height: 100vh;
        z-index: 1100;
        transform: translateX(-100%);
        box-shadow: 0 0 40px rgba(0,0,0,0.5);
    }

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

    .admin-sidebar-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .admin-sidebar-toggle {
        display: inline-flex;
    }

    .admin-topbar {
        padding: 10px 16px;
    }

    .admin-content {
        padding: 16px 14px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 18px;
    }

    .kpi-card {
        padding: 14px;
    }

    .kpi-value {
        font-size: 20px;
    }

    .kpi-icon {
        width: 38px;
        height: 38px;
    }

    .kpi-icon .material-icons {
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .admin-topbar {
        padding: 10px 12px;
    }

    .admin-content {
        padding: 14px 10px;
    }

    .admin-card-header {
        padding: 12px 14px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .admin-card-header > form {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px !important;
    }

    .admin-card-header > form input,
    .admin-card-header > form select {
        flex: 1;
        min-width: 120px;
    }

    .admin-card-header > .btn-adm,
    .admin-card-header > div > .btn-adm {
        width: 100%;
        justify-content: center;
    }

    .adm-modal-backdrop {
        padding: 8px;
    }

    .adm-modal-dialog {
        max-height: calc(100vh - 16px);
        border-radius: 12px;
        margin: auto;
    }

    .adm-modal-body {
        padding: 14px;
    }

    .adm-modal-header {
        padding: 12px 14px;
    }

    .adm-modal-footer {
        padding: 10px 14px;
    }

    .admin-form-control {
        font-size: 15px; /* iOS zoom prevention */
    }

    .seq-badge {
        font-size: 10.5px;
        min-width: 22px;
        height: 24px;
        padding: 0 4px;
    }

    .btn-adm-move {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 576px) {
    .btn-text-desktop {
        display: none;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .kpi-card {
        padding: 12px 10px;
    }

    .kpi-label {
        font-size: 10.5px;
    }

    .kpi-value {
        font-size: 18px;
    }

    .kpi-icon {
        width: 34px;
        height: 34px;
    }

    .kpi-icon .material-icons {
        font-size: 18px;
    }
}

@media (max-width: 380px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}
