/* =========================================================
   LUXURIOUS RP LLC - ADMIN INTERFACE
   Shared by login.html, dashboard.html, product_admin.php,
   and product_edit.php
   ========================================================= */

:root {
    --admin-bg: #070707;
    --admin-surface: #101010;
    --admin-surface-light: #161616;
    --admin-field-bg: #090909;
    --admin-border: #2d2d2d;
    --admin-border-light: #444;
    --admin-text: #f1f1f1;
    --admin-muted: #929292;
    --admin-gold: #d4af37;
    --admin-gold-light: #f5d98c;
    --admin-gold-soft: rgba(212, 175, 55, 0.10);
    --admin-danger: #b42323;
    --admin-danger-hover: #d62f2f;
    --admin-success: #a7edbd;
    --admin-error: #ffb0b0;
    --admin-radius: 10px;
    --admin-shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
}

body {
    margin: 0;
    background: var(--admin-bg);
    color: var(--admin-text);
    font-family: "Segoe UI", Arial, sans-serif;
}

button,
input,
textarea,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

img,
video {
    max-width: 100%;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--admin-gold);
    outline-offset: 3px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =========================================================
   SHARED ADMIN SHELL
   ========================================================= */

.admin-page {
    min-height: 100vh;
    background: var(--admin-bg);
    color: var(--admin-text);
}

.admin-app {
    width: min(calc(100% - 32px), 1440px);
    margin: 0 auto;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 32px 0 24px;
    border-bottom: 1px solid var(--admin-border);
}

.admin-brand-lockup {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.admin-brand-mark,
.login-brand-mark {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: var(--admin-gold);
    background: var(--admin-gold-soft);
    border: 1px solid var(--admin-gold);
    border-radius: 50%;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.admin-brand-mark {
    width: 52px;
    height: 52px;
    font-size: 0.74rem;
}

.admin-brand-lockup h1 {
    margin: 3px 0 0;
    color: var(--admin-text);
    font-size: clamp(1.5rem, 3vw, 2.15rem);
    line-height: 1.15;
}

.admin-eyebrow {
    display: block;
    margin-bottom: 10px;
    color: var(--admin-gold);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
}

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 0;
    border-bottom: 1px solid var(--admin-border);
}

.admin-nav a,
.admin-nav a:visited {
    padding: 9px 14px;
    color: var(--admin-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
    text-decoration: none;
    font-weight: 700;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.admin-nav a:hover,
.admin-nav a.active,
.admin-nav a[aria-current="page"] {
    color: var(--admin-gold);
    background: var(--admin-gold-soft);
    border-color: rgba(212, 175, 55, 0.28);
}

.admin-main {
    padding: 46px 0 70px;
}

.admin-page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.admin-page-heading h2 {
    margin: 5px 0 9px;
    color: var(--admin-text);
    font-size: clamp(1.8rem, 4vw, 3rem);
    line-height: 1.1;
}

.admin-page-heading p {
    max-width: 760px;
    margin: 0;
    color: var(--admin-muted);
    line-height: 1.65;
}

.admin-panel {
    overflow: hidden;
    background: var(--admin-surface);
    border: 1px solid rgba(212, 175, 55, 0.28);
    border-radius: 14px;
    box-shadow: var(--admin-shadow);
}

.admin-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px;
    border-bottom: 1px solid var(--admin-border);
}

.admin-panel-heading h3 {
    margin: 4px 0 0;
    color: var(--admin-text);
    font-size: 1.45rem;
}

.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px;
    border-bottom: 1px solid var(--admin-border);
}

.admin-footer {
    padding: 24px 0 36px;
    color: var(--admin-muted);
    text-align: center;
    border-top: 1px solid var(--admin-border);
    font-size: 0.8rem;
}

.admin-footer p {
    margin: 0;
}

/* =========================================================
   BUTTONS
   ========================================================= */

.admin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 11px 18px;
    border: 1px solid transparent;
    border-radius: 7px;
    font: inherit;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease,
                color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.admin-btn-primary {
    color: #111;
    background: var(--admin-gold);
    border-color: var(--admin-gold);
}

.admin-btn-primary:hover:not(:disabled) {
    background: var(--admin-gold-light);
    border-color: var(--admin-gold-light);
    transform: translateY(-1px);
}

.admin-btn-secondary {
    color: var(--admin-text);
    background: transparent;
    border-color: var(--admin-border-light);
}

.admin-btn-secondary:hover:not(:disabled) {
    color: var(--admin-gold);
    background: var(--admin-gold-soft);
    border-color: var(--admin-gold);
}

.admin-btn-danger {
    color: #fff;
    background: var(--admin-danger);
    border-color: var(--admin-danger);
}

.admin-btn-danger:hover:not(:disabled) {
    background: var(--admin-danger-hover);
    border-color: var(--admin-danger-hover);
}

.admin-btn-small {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 0.84rem;
}

.admin-btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

/* =========================================================
   FORM CONTROLS
   ========================================================= */

.admin-field {
    margin-bottom: 22px;
}

.admin-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--admin-text);
    font-size: 0.85rem;
    font-weight: 700;
}

.admin-field input,
.admin-field textarea,
.admin-field select,
.admin-search-wrap input,
.pagination-limit select {
    width: 100%;
    margin: 0;
    padding: 12px 14px;
    color: var(--admin-text);
    background: var(--admin-field-bg);
    border: 1px solid #383838;
    border-radius: 8px;
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease,
                background 0.2s ease;
}

.admin-field textarea {
    min-height: 170px;
    resize: vertical;
    line-height: 1.6;
}

.admin-field input:hover,
.admin-field textarea:hover,
.admin-field select:hover,
.admin-search-wrap input:hover,
.pagination-limit select:hover {
    border-color: #555;
}

.admin-field input:focus,
.admin-field textarea:focus,
.admin-field select:focus,
.admin-search-wrap input:focus,
.pagination-limit select:focus {
    outline: none;
    background: #0d0d0d;
    border-color: var(--admin-gold);
    box-shadow: 0 0 0 3px var(--admin-gold-soft);
}

.admin-field input::placeholder,
.admin-field textarea::placeholder,
.admin-search-wrap input::placeholder {
    color: #696969;
}

.field-optional {
    color: var(--admin-muted);
    font-size: 0.75rem;
    font-weight: 500;
}

/* =========================================================
   ALERTS AND STATUS TEXT
   ========================================================= */

.admin-alert {
    margin-bottom: 20px;
    padding: 14px 17px;
    border-radius: 9px;
    line-height: 1.55;
}

.admin-alert.success {
    color: var(--admin-success);
    background: rgba(23, 107, 56, 0.20);
    border: 1px solid rgba(49, 168, 92, 0.55);
}

.admin-alert.error {
    color: var(--admin-error);
    background: rgba(140, 29, 29, 0.20);
    border: 1px solid rgba(217, 74, 74, 0.50);
}

.admin-status {
    min-height: 0;
    margin: 0;
    padding: 0 20px;
    color: var(--admin-muted);
    font-size: 0.88rem;
}

.admin-status:not(:empty) {
    padding-top: 14px;
}

.admin-status.error {
    color: #ff8585;
}

/* =========================================================
   LOGIN
   ========================================================= */

.login-page {
    min-height: 100vh;
    padding: 30px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at top, rgba(212, 175, 55, 0.09), transparent 38%),
        var(--admin-bg);
}

.login-shell {
    width: 100%;
    display: flex;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 430px;
    overflow: hidden;
    background: var(--admin-surface);
    border: 1px solid rgba(212, 175, 55, 0.38);
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.login-brand {
    padding: 44px 40px 32px;
    text-align: center;
    border-bottom: 1px solid var(--admin-border);
}

.login-brand-mark {
    width: 64px;
    height: 64px;
    margin: 0 auto 22px;
    font-size: 0.85rem;
}

.login-brand h1 {
    margin: 0 0 12px;
    color: var(--admin-text);
    font-size: 1.9rem;
    line-height: 1.2;
}

.login-brand p {
    margin: 0;
    color: var(--admin-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.login-form {
    padding: 35px 40px;
}

.login-button {
    width: 100%;
    margin-top: 5px;
    padding: 13px 20px;
}

.login-message {
    min-height: 22px;
    margin: 18px 0 0;
    color: #ff7373;
    text-align: center;
    font-size: 0.88rem;
    line-height: 1.5;
}

.login-footer {
    padding: 18px 30px;
    color: var(--admin-muted);
    text-align: center;
    border-top: 1px solid var(--admin-border);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

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

.admin-search-wrap {
    width: min(100%, 520px);
}

.admin-table-scroll {
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
}

.admin-table {
    width: 100%;
    min-width: 980px;
    margin: 0;
    border-collapse: collapse;
    table-layout: auto;
}

.admin-table th,
.admin-table td {
    padding: 15px 16px;
    color: var(--admin-text);
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--admin-border);
    text-align: left;
    vertical-align: top;
    overflow-wrap: anywhere;
}

.admin-table th {
    color: var(--admin-muted);
    background: #0c0c0c;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

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

.admin-table tbody tr:hover td {
    background: rgba(212, 175, 55, 0.035);
}

.admin-table .checkbox-column {
    width: 44px;
    text-align: center;
    vertical-align: middle;
}

.admin-table input[type="checkbox"] {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--admin-gold);
}

.sort-button {
    padding: 0;
    color: inherit;
    background: transparent;
    border: 0;
    font: inherit;
    font-weight: 700;
    text-transform: inherit;
    letter-spacing: inherit;
    cursor: pointer;
}

.sort-button:hover,
.sort-button:focus-visible {
    color: var(--admin-gold);
}

.message-cell {
    min-width: 320px;
    max-width: 560px;
    line-height: 1.55;
    white-space: pre-wrap;
}

.created-cell {
    min-width: 130px;
    color: var(--admin-muted) !important;
    white-space: nowrap;
}

.admin-empty-state {
    padding: 46px !important;
    color: var(--admin-muted) !important;
    text-align: center !important;
}

.admin-pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 18px;
    padding: 18px 20px;
    color: var(--admin-muted);
    border-top: 1px solid var(--admin-border);
}

.pagination-buttons {
    display: flex;
    gap: 8px;
}

.pagination-limit {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-limit select {
    width: auto;
    padding: 8px 30px 8px 10px;
}

/* =========================================================
   MANAGE PRODUCTS AND PRODUCT EDIT
   ========================================================= */

.product-total {
    flex: 0 0 auto;
    padding: 9px 13px;
    color: var(--admin-gold);
    background: var(--admin-gold-soft);
    border: 1px solid rgba(212, 175, 55, 0.28);
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.product-form-panel {
    margin-bottom: 34px;
    overflow: visible;
}

.product-form {
    padding: 26px;
}

.product-form-grid,
.product-upload-grid,
.edit-media-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.product-upload-grid,
.edit-media-grid {
    margin-top: 8px;
}

.product-field-full {
    grid-column: 1 / -1;
}

.upload-card,
.current-media-card {
    padding: 20px;
    background: #0c0c0c;
    border: 1px solid var(--admin-border);
    border-radius: 11px;
}

.upload-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 15px;
}

.upload-card-heading h4 {
    margin: 0 0 5px;
    color: var(--admin-text);
    font-size: 1rem;
}

.upload-card-heading p {
    margin: 0;
    color: var(--admin-muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.required-badge,
.optional-badge,
.category-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-weight: 700;
}

.required-badge,
.optional-badge {
    padding: 5px 8px;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.required-badge {
    color: var(--admin-gold);
    background: var(--admin-gold-soft);
}

.optional-badge {
    color: var(--admin-muted);
    background: #181818;
}

.drop-zone {
    display: flex;
    min-height: 160px;
    margin-bottom: 14px;
    padding: 20px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 7px;
    color: var(--admin-text);
    background: #080808;
    border: 1px dashed #555;
    border-radius: 9px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.dragover {
    outline: none;
    background: var(--admin-gold-soft);
    border-color: var(--admin-gold);
}

.drop-zone-title {
    font-weight: 700;
}

.drop-zone-help {
    color: var(--admin-muted);
    font-size: 0.82rem;
}

.upload-preview {
    display: grid;
    width: 100%;
    gap: 9px;
    margin-top: 10px;
    color: var(--admin-muted);
    font-size: 0.78rem;
}

.upload-preview img,
.upload-preview video {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    border-radius: 7px;
}

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

.product-toolbar p {
    margin: 0;
    color: var(--admin-muted);
    line-height: 1.5;
}

.product-admin-table {
    min-width: 1120px;
}

.product-id-cell {
    color: var(--admin-muted) !important;
    white-space: nowrap;
}

.product-name-cell {
    min-width: 200px;
}

.description-preview {
    display: block;
    width: 100%;
    min-width: 250px;
    max-width: 430px;
    padding: 0;
    color: var(--admin-text);
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
}

.description-preview span {
    display: -webkit-box;
    overflow: hidden;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.description-preview small {
    display: block;
    margin-top: 7px;
    color: var(--admin-gold);
    font-weight: 700;
}

.description-preview:hover small {
    text-decoration: underline;
}

.category-badge {
    padding: 6px 9px;
    color: var(--admin-gold-light);
    background: var(--admin-gold-soft);
    border: 1px solid rgba(212, 175, 55, 0.24);
    white-space: nowrap;
    font-size: 0.75rem;
}

.product-media-actions,
.action-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.product-thumb-button {
    display: block;
    width: 76px;
    height: 58px;
    overflow: hidden;
    padding: 0;
    background: #050505;
    border: 1px solid #383838;
    border-radius: 7px;
    cursor: pointer;
}

.product-thumb-button:hover,
.product-thumb-button:focus-visible {
    border-color: var(--admin-gold);
}

.product-thumb-button img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.current-media-preview {
    display: block;
    width: 100%;
    min-height: 220px;
    overflow: hidden;
    padding: 0;
    background: #050505;
    border: 1px solid #383838;
    border-radius: 9px;
    cursor: pointer;
}

.current-media-preview:hover,
.current-media-preview:focus-visible {
    outline: none;
    border-color: var(--admin-gold);
}

.current-media-preview img {
    display: block;
    width: 100%;
    height: 260px;
    object-fit: contain;
}

.current-video-preview,
.no-media-state {
    display: grid;
    min-height: 220px;
    width: 100%;
    place-items: center;
    padding: 20px;
    background: #080808;
    border-radius: 9px;
    text-align: center;
}

.current-video-preview {
    color: var(--admin-gold);
    border: 1px solid #383838;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.current-video-preview:hover,
.current-video-preview:focus-visible {
    outline: none;
    background: var(--admin-gold-soft);
    border-color: var(--admin-gold);
}

.no-media-state {
    color: var(--admin-muted);
    border: 1px dashed #404040;
}

/* =========================================================
   MODALS
   ========================================================= */

.admin-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    padding: 20px;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(4px);
}

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

.admin-modal-dialog {
    width: min(100%, 620px);
    max-height: min(88vh, 820px);
    overflow: auto;
    padding: 24px;
    color: var(--admin-text);
    background: var(--admin-surface);
    border: 1px solid rgba(212, 175, 55, 0.38);
    border-radius: 13px;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
}

.media-modal-dialog {
    width: min(100%, 920px);
}

.confirm-dialog {
    width: min(100%, 470px);
}

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

.admin-modal-header h3 {
    margin: 0;
    color: var(--admin-text);
}

.modal-close {
    width: 38px;
    height: 38px;
    padding: 0;
    color: var(--admin-text);
    background: transparent;
    border: 1px solid var(--admin-border-light);
    border-radius: 50%;
    font-size: 1.45rem;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--admin-gold);
    border-color: var(--admin-gold);
}

.media-preview-content img,
.media-preview-content video {
    display: block;
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    background: #050505;
    border-radius: 9px;
}

.desc-text {
    color: var(--admin-text);
    line-height: 1.7;
    white-space: pre-wrap;
}

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

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

@media (max-width: 760px) {
    .admin-app {
        width: min(calc(100% - 24px), 1440px);
    }

    .admin-topbar,
    .admin-toolbar,
    .admin-page-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-topbar > .admin-btn,
    .admin-toolbar > .admin-btn,
    .admin-search-wrap {
        width: 100%;
    }

    .admin-main {
        padding: 34px 0 54px;
    }

    .admin-pagination {
        grid-template-columns: 1fr;
    }

    .pagination-buttons,
    .pagination-limit {
        justify-self: start;
    }

    .product-form-grid,
    .product-upload-grid,
    .edit-media-grid {
        grid-template-columns: 1fr;
    }

    .product-field-full {
        grid-column: auto;
    }

    .product-form,
    .admin-panel-heading {
        padding: 20px;
    }

    .product-form-actions,
    .edit-form-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .product-form-actions .admin-btn,
    .product-toolbar .admin-btn,
    .edit-form-actions .admin-btn {
        width: 100%;
    }

    .product-total {
        align-self: flex-start;
    }

    .admin-modal {
        padding: 12px;
    }

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

@media (max-width: 520px) {
    .login-page {
        padding: 20px 14px;
    }

    .login-brand {
        padding: 35px 24px 27px;
    }

    .login-form {
        padding: 28px 24px;
    }

    .login-brand h1 {
        font-size: 1.65rem;
    }

    .admin-brand-lockup {
        align-items: flex-start;
    }

    .admin-brand-mark {
        width: 46px;
        height: 46px;
    }

    .admin-nav a {
        flex: 1 1 auto;
        text-align: center;
    }

    .admin-toolbar,
    .admin-panel-heading,
    .product-form {
        padding-left: 16px;
        padding-right: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
