﻿/* =========================
   ADMIN PRODUCTS PAGE
========================= */

/* Page wrapper */
.admin-products-page {
    width: 100%;
    max-width: 1200px;
}

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

    .admin-products-header h2 {
        font-size: 1.6rem;
        font-weight: 700;
    }

/* Card container */
.admin-products-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,.06);
}

/* =========================
   PRODUCTS TABLE
========================= */

.products-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

    .products-table thead th {
        font-size: .75rem;
        color: #9aa0a6;
        font-weight: 600;
        text-transform: uppercase;
        padding: 0 8px 12px;
        text-align: left;
    }

    .products-table tbody tr {
        background: #fff;
        border-radius: 14px;
        box-shadow: 0 2px 12px rgba(0,0,0,.04);
        transition: transform .15s ease, box-shadow .15s ease;
    }

        .products-table tbody tr:hover {
            transform: translateY(-1px);
            box-shadow: 0 6px 18px rgba(0,0,0,.08);
        }

    .products-table td {
        padding: 14px 10px;
        font-size: .95rem;
        vertical-align: middle;
        border: none;
    }

    /* Fix rounded rows */
    .products-table tbody tr td:first-child {
        border-top-left-radius: 14px;
        border-bottom-left-radius: 14px;
    }

    .products-table tbody tr td:last-child {
        border-top-right-radius: 14px;
        border-bottom-right-radius: 14px;
    }

    /* =========================
   PRODUCT IMAGE
========================= */

    .products-table .product-thumb,
    .product-thumb {
        width: 48px;
        height: 48px;
        border-radius: 12px;
        object-fit: cover;
        background: #f3f4f6;
    }

/* =========================
   STATUS (BEST SELLER)
========================= */

.status-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge-best {
    background: linear-gradient(135deg, #ff8a00, #ffcc70);
    color: #fff;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 600;
    white-space: nowrap;
}

/* Toggle */
.toggle {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* =========================
   ACTIONS
========================= */

.product-actions,
.action-cell {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

/* Icon buttons */
.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: #fee2e2;
    color: #c62828;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .15s ease, background .15s ease;
}

    .icon-btn:hover {
        transform: scale(1.08);
        background: #fecaca;
    }

/* Toggle switch */
.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d5db;
    border-radius: 999px;
    transition: .2s;
}

    .slider:before {
        position: absolute;
        content: "";
        height: 14px;
        width: 14px;
        left: 3px;
        bottom: 3px;
        background-color: white;
        border-radius: 50%;
        transition: .2s;
    }

.switch input:checked + .slider {
    background-color: #f59e0b;
}

    .switch input:checked + .slider:before {
        transform: translateX(16px);
    }

/* Soft action button */
.btn-soft {
    background: #eef3ff;
    color: #4f6ef7;
    border-radius: 12px;
    padding: 8px 14px;
    font-size: .85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}

    .btn-soft:hover {
        background: #dde6ff;
        transform: translateY(-1px);
    }

/* =========================
   EMPTY STATE
========================= */

.products-empty {
    padding: 50px;
    text-align: center;
    color: #9aa0a6;
    font-size: .95rem;
}

/* =========================
   ADD / UPDATE PRODUCT MODAL
========================= */

.admin-product-modal {
    background: #fff;
    padding: 30px;
    border-radius: 22px;
    width: 100%;
    max-width: 700px;
    box-shadow: 0 25px 60px rgba(0,0,0,.25);
}

    .admin-product-modal h4 {
        font-weight: 700;
        margin-bottom: 20px;
    }

/* =========================
   FORM GRID
========================= */

.product-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

    .product-form-grid .form-group {
        display: flex;
        flex-direction: column;
    }

    .product-form-grid .full {
        grid-column: span 2;
    }

/* =========================
   MODAL ACTIONS
========================= */

.product-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* =========================
   IMAGE GRID (UPLOADS)
========================= */

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.image-card {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 8px;
    text-align: center;
    transition: box-shadow .15s ease, transform .15s ease;
}

.image-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,0,0,.08);
}

/* ── FOCAL POINT PICKER ── */
.focal-wrap {
    display: flex;
    justify-content: center;
}

.focal-preview {
    width: 200px;
    height: 200px;
    flex-shrink: 0;
    border-radius: 10px;
    cursor: crosshair;
    position: relative;
    overflow: hidden;
}

.focal-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.focal-preview:hover .focal-hint {
    opacity: 1;
}

.focal-hint {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 100px;
    opacity: 0;
    transition: opacity .2s;
    pointer-events: none;
    white-space: nowrap;
}

.focal-dot {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #c4826a;
    box-shadow: 0 0 0 2px rgba(0,0,0,.3);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.focal-saving {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.5);
    border-radius: 10px;
    font-size: 18px;
    color: #c4826a;
}

.image-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: .8rem;
}

/* =========================
   PRODUCT GRID (IF USED)
========================= */

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1200px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

    .products-table thead {
        display: none;
    }
}

@media (max-width: 768px) {
    .admin-products-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .admin-products-card {
        padding: 14px;
    }

    .products-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

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

    .product-form-grid .full {
        grid-column: span 1;
    }

    .admin-product-modal {
        padding: 20px 16px;
        border-radius: 16px;
        max-width: 100%;
    }

    .product-modal-actions {
        flex-direction: column-reverse;
    }

    .product-modal-actions button {
        width: 100%;
    }
}

/* =========================
   VARIANT MODAL
========================= */

.admin-modal-wide {
    max-width: 860px !important;
    width: 90vw;
}

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

.variant-table {
    font-size: .85rem;
}

.variant-table input.form-control-sm {
    padding: 4px 6px;
    font-size: .85rem;
}

.variant-inactive td {
    opacity: .55;
}

.variant-attrs {
    font-size: .82rem;
    color: #555;
}

/* Generate section */
.variant-generate-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 16px;
}

.generate-row {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 10px;
}

.generate-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.generate-attr-name {
    font-weight: 600;
    font-size: .9rem;
}

.chip-input-area {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    min-height: 36px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--color-primary, #4f6ef7);
    color: #fff;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: .8rem;
}

.chip-remove {
    background: none;
    border: none;
    color: rgba(255,255,255,.8);
    cursor: pointer;
    padding: 0;
    font-size: 14px;
    line-height: 1;
}

.chip-input {
    border: 1px solid #d1d5db;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: .82rem;
    outline: none;
    min-width: 140px;
}

.attr-picker {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 320px;
}

.new-attr-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-sm {
    padding: 5px 10px;
    font-size: .8rem;
    border-radius: 8px;
}

.icon-btn.sm {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: .75rem;
}
