/* ===== ADMIN PAGE ===== */
.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: var(--transition);
}

.back-link:hover {
    color: var(--text-primary);
}

.logout-btn {
    padding: 6px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 50px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.logout-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.change-pass-btn {
    padding: 6px 16px;
    background: #f59e0b;
    border: none;
    border-radius: 50px;
    color: white;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    margin-right: 8px;
}

.change-pass-btn:hover {
    background: #d97706;
}

/* Login */
.admin-login {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: var(--shadow);
}

.login-box h2 {
    font-size: 20px;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.login-box input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    margin-bottom: 16px;
    transition: var(--transition);
}

.login-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-box button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--accent), #7c5ce7);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.login-box button:hover {
    filter: brightness(1.1);
}

.login-error {
    color: var(--danger);
    font-size: 13px;
    margin-top: 12px;
    min-height: 18px;
}

/* Dashboard */
.admin-dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
}

.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}

.tab-btn {
    padding: 10px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 6px 6px 0 0;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-light);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: var(--bg-light);
}

.visit-paths {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 400px;
}

.visit-path {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 50px;
    font-size: 11px;
    color: var(--text-secondary);
    direction: ltr;
}

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

.admin-header h1 {
    font-size: 24px;
    color: var(--text-primary);
}

.add-btn {
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--accent), #7c5ce7);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.add-btn:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.admin-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.admin-stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 24px;
    flex: 1;
    min-width: 160px;
}

.admin-stat .num {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent-light);
}

.admin-stat .label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Table */
.products-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.products-table {
    width: 100%;
    border-collapse: collapse;
}

.products-table th,
.products-table td {
    padding: 14px 16px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.products-table th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.products-table td {
    color: var(--text-primary);
}

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

.products-table tr:hover td {
    background: var(--bg-card-hover);
}

.product-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: var(--radius);
    background: var(--bg-secondary);
}

.source-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
}

.source-photo { background: rgba(108, 92, 231, 0.15); color: var(--accent-light); }
.source-manual { background: rgba(0, 184, 148, 0.15); color: var(--success); }

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

.btn-edit, .btn-delete {
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.btn-edit {
    background: transparent;
    color: var(--accent-light);
}

.btn-edit:hover {
    border-color: var(--accent);
    background: rgba(108, 92, 231, 0.1);
}

.btn-delete {
    background: transparent;
    color: var(--danger);
}

.btn-delete:hover {
    border-color: var(--danger);
    background: rgba(231, 76, 60, 0.1);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.modal-sm {
    max-width: 420px;
}

.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: 18px;
    color: var(--text-primary);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.product-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.product-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.product-form input[type="text"],
.product-form input[type="number"],
.product-form input[type="file"],
.product-form textarea,
.product-form input[type="password"] {
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.product-form input:focus,
.product-form textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row label {
    flex: 1;
}

.current-image {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.current-image img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.btn-cancel, .btn-save {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-cancel:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.btn-save {
    background: linear-gradient(135deg, var(--accent), #7c5ce7);
    border: none;
    color: white;
}

.btn-save:hover {
    filter: brightness(1.1);
}

/* ===== GALLERY EDITOR ===== */
.gallery-editor { display: flex; flex-direction: column; gap: 8px; }
.gallery-current { display: flex; flex-direction: column; gap: 8px; }
.gallery-current > span { font-size: 0.85rem; color: #666; }
.gallery-list, .gallery-preview {
    display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px;
}
.gallery-item {
    position: relative;
    width: 84px; height: 84px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
    background: #f1f5f9;
}
.gallery-item.new { border-style: dashed; border-color: #94a3b8; }
.gallery-item img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
}
.gallery-item-actions {
    position: absolute; top: 4px; left: 4px; right: 4px;
    display: flex; justify-content: space-between;
    opacity: 0; transition: opacity .15s;
}
.gallery-item:hover .gallery-item-actions { opacity: 1; }
.gal-btn {
    width: 24px; height: 24px;
    border: none; border-radius: 6px;
    background: rgba(15,23,42,.75);
    color: #fff; font-size: 12px;
    cursor: pointer; line-height: 1;
    display: flex; align-items: center; justify-content: center;
}
.gal-btn:hover { background: rgba(15,23,42,.95); }
.gallery-hint { font-size: 0.8rem; color: #94a3b8; }

/* ===== DOCUMENTS EDITOR ===== */
.docs-list, #newDocsPreview { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.doc-item {
    display: flex; align-items: center; gap: 10px;
    background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 8px; padding: 8px 12px;
}
.doc-item.new { border-style: dashed; border-color: #94a3b8; }
.doc-icon { font-size: 1rem; }
.doc-name {
    flex: 1; font-size: 0.85rem; color: #334155;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr;
    text-align: right;
}

/* Responsive */
@media (max-width: 768px) {
    .products-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .products-table {
        min-width: 700px;
    }

    .form-row {
        flex-direction: column;
    }

    .admin-header {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-dashboard {
        padding: 20px 12px;
    }

    .admin-stats {
        gap: 10px;
    }

    .admin-stat {
        padding: 12px 14px;
        min-width: 120px;
    }

    .modal-overlay {
        padding: 12px;
        align-items: flex-end;
    }

    .modal {
        max-height: 94vh;
        border-radius: 16px 16px 0 0;
    }

    .product-form {
        padding: 18px;
    }

    .navbar .nav-container {
        padding: 0 12px;
    }

    .login-box {
        padding: 28px 20px;
    }
}

@media (max-width: 480px) {
    .admin-stat {
        flex: 1 1 40%;
        min-width: 90px;
    }

    .admin-stat .num {
        font-size: 18px;
    }

    .add-btn {
        width: 100%;
    }

    .modal-header {
        padding: 16px 18px;
    }

    .change-pass-btn {
        padding: 6px 10px;
        font-size: 12px;
        margin-right: 4px;
    }
}
/* ===== SKU BADGE ===== */
.sku-badge {
    display: inline-block;
    padding: 3px 8px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    direction: ltr;
    white-space: nowrap;
}
