/* ==========================================
   ADMIN DASHBOARD
   ========================================== */

.admin-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.admin-title {
    font-size: 28px;
    font-weight: 400;
    color: #191919;
}

.admin-user {
    font-size: 13px;
    color: #888;
}

/* Tabs */
.admin-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e4e4e4;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.admin-tab {
    padding: 12px 20px;
    font-family: 'Arimo', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #999;
    background: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    transition: color 0.2s;
}

.admin-tab:hover { color: #191919; }

.admin-tab.active {
    color: #191919;
}

.admin-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #191919;
}

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

.admin-section.active {
    display: block;
}

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

.stat-card {
    background: #fff;
    border: 1px solid #e4e4e4;
    border-radius: 8px;
    padding: 20px;
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #191919;
}

.stat-sub {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

/* Tables */
.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid #e4e4e4;
    border-radius: 8px;
    background: #fff;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th {
    text-align: left;
    padding: 14px 16px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #888;
    background: #f9f9f9;
    border-bottom: 1px solid #e4e4e4;
    white-space: nowrap;
}

.admin-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    color: #191919;
    vertical-align: top;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

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

/* Status badges */
.status-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
}

.badge-pending { background: #fef3c7; color: #92400e; }
.badge-confirmed { background: #dbeafe; color: #1e40af; }
.badge-processing { background: #e0e7ff; color: #3730a3; }
.badge-shipped { background: #ede9fe; color: #5b21b6; }
.badge-delivering { background: #fce7f3; color: #9d174d; }
.badge-delivered { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }

/* Action buttons */
.admin-btn {
    padding: 6px 14px;
    font-family: 'Arimo', sans-serif;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #191919;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-btn:hover {
    border-color: #191919;
}

.admin-btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

.admin-btn-danger {
    color: #a33;
    border-color: #fca5a5;
}

.admin-btn-danger:hover {
    background: #fef2f2;
    border-color: #a33;
}

.admin-btn-success {
    color: #065f46;
    border-color: #86efac;
}

.admin-btn-success:hover {
    background: #f0fdf4;
    border-color: #065f46;
}

.admin-btn-primary {
    background: #191919;
    color: #fff;
    border-color: #191919;
}

.admin-btn-primary:hover {
    background: #333;
}

.btn-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Status select */
.status-select {
    padding: 6px 10px;
    font-family: 'Arimo', sans-serif;
    font-size: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    outline: none;
}

/* Admin notes */
.admin-notes-input {
    width: 100%;
    padding: 8px 10px;
    font-family: 'Arimo', sans-serif;
    font-size: 13px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    min-height: 60px;
    outline: none;
    transition: border-color 0.2s;
}

.admin-notes-input:focus {
    border-color: #191919;
}

/* Toggle switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #ccc;
    border-radius: 22px;
    transition: 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle input:checked + .toggle-slider {
    background: #191919;
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

/* Order detail modal */
.admin-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}

.admin-modal.active {
    display: flex;
}

.admin-modal-content {
    background: #fff;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 32px;
}

.admin-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.admin-modal-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: #191919;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 4px;
}

.modal-close:hover { color: #191919; }

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.detail-label { color: #888; }
.detail-value { color: #191919; font-weight: 500; }

/* Promo form */
.promo-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 20px;
}

.promo-form-grid .auth-field {
    margin-bottom: 0;
}

.promo-form-grid .auth-field.full {
    grid-column: 1 / -1;
}

.promo-form-grid input,
.promo-form-grid select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #ddd;
    border-radius: 4px;
    font-family: 'Arimo', sans-serif;
    font-size: 14px;
    color: #191919;
    background: #fff;
    outline: none;
}

.promo-form-grid select {
    cursor: pointer;
}

.promo-form-grid input:focus,
.promo-form-grid select:focus {
    border-color: #191919;
}

/* Banner edit cards */
.banner-edit-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid #e4e4e4;
    border-radius: 6px;
    background: #fff;
    margin-bottom: 8px;
}

.banner-edit-thumb {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 4px;
    background: #f7f7f8;
    flex-shrink: 0;
}

.banner-edit-info {
    flex: 1;
    min-width: 0;
}

.banner-edit-info strong {
    font-size: 15px;
    color: #191919;
}

.banner-edit-label {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: #f0f0f0;
    color: #666;
    padding: 2px 8px;
    border-radius: 3px;
    margin-left: 8px;
    vertical-align: middle;
}

@media (max-width: 767px) {
    .banner-edit-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .banner-edit-thumb {
        width: 100%;
        height: 120px;
    }
}

/* Image uploads */
.upload-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.upload-preview {
    width: 80px;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    background: #f7f7f8;
    border: 1px solid #e4e4e4;
    flex-shrink: 0;
}

.upload-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.upload-controls input[type="file"] {
    font-family: 'Arimo', sans-serif;
    font-size: 13px;
    color: #555;
}

.upload-status {
    font-size: 12px;
    min-height: 16px;
}

.gallery-item {
    display: inline-flex;
    align-items: flex-end;
    gap: 8px;
    margin: 0 10px 10px 0;
    vertical-align: top;
}

.gallery-item .upload-preview {
    width: 70px;
    height: 88px;
}

/* Product edit cards */
.product-edit-card {
    display: flex;
    gap: 20px;
    padding: 20px;
    border: 1px solid #e4e4e4;
    border-radius: 8px;
    background: #fff;
    margin-bottom: 12px;
    align-items: flex-start;
}

.product-edit-images {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.product-edit-thumb {
    width: 70px;
    height: 90px;
    object-fit: cover;
    border-radius: 4px;
    background: #f7f7f8;
}

.product-edit-info {
    flex: 1;
    min-width: 0;
}

.product-edit-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.product-edit-top h3 {
    font-size: 16px;
    font-weight: 600;
    color: #191919;
}

.product-edit-toggles {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #555;
}

.product-edit-actions {
    flex-shrink: 0;
}

@media (max-width: 767px) {
    .product-edit-card {
        flex-direction: column;
        gap: 14px;
    }

    .product-edit-top {
        flex-direction: column;
        gap: 4px;
    }

    .product-edit-toggles {
        gap: 14px;
    }
}

/* Empty state */
.admin-empty {
    text-align: center;
    padding: 40px;
    color: #888;
    font-size: 15px;
}

/* Active/inactive text */
.text-active { color: #065f46; font-weight: 600; }
.text-inactive { color: #999; }
.text-expired { color: #a33; font-size: 11px; }

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .admin-page {
        padding: 20px 12px 60px;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .admin-title { font-size: 22px; }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-value { font-size: 22px; }

    .admin-tab {
        padding: 10px 14px;
        font-size: 11px;
    }

    .promo-form-grid {
        grid-template-columns: 1fr;
    }

    .admin-modal-content {
        padding: 20px;
    }
}
