/* ============================================================
   E-Catalog Dashboard — Main Stylesheet
   Premium black/gold sport fashion theme
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* --- CSS Variables --- */
:root {
    --bg-primary:    #0a0a0a;
    --bg-surface:    #111111;
    --bg-card:       #1a1a1a;
    --bg-input:      #222222;
    --border-subtle: #2a2a2a;
    --border-gold:   #c9a84c40;
    --accent-gold:   #c9a84c;
    --accent-gold-light: #e8c060;
    --accent-white:  #f0f0f0;
    --text-muted:    #888888;
    --text-dim:      #555555;
    --danger:        #e74c3c;
    --danger-dark:   #c0392b;
    --success:       #27ae60;
    --radius:        8px;
    --radius-sm:     4px;
    --shadow:        0 4px 24px rgba(0,0,0,0.6);
    --transition:    0.2s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-primary);
    color: var(--accent-white);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent-gold); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-gold-light); }

img { max-width: 100%; display: block; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-gold); }

/* ============================================================
   NAVIGATION BAR
   ============================================================ */
.navbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-gold);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.navbar-brand img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.navbar-brand-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-gold);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.navbar-username {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.navbar-username span {
    color: var(--accent-white);
    font-weight: 600;
}

.navbar-nav a {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.navbar-nav a:hover { color: var(--accent-white); background: var(--bg-card); }
.navbar-nav a.active { color: var(--accent-gold); }

.btn-logout {
    color: var(--text-muted) !important;
    border: 1px solid var(--border-subtle) !important;
}
.btn-logout:hover {
    color: var(--danger) !important;
    border-color: var(--danger) !important;
    background: rgba(231,76,60,0.08) !important;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.page-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
}

.page-header {
    margin-bottom: 28px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent-white);
    letter-spacing: -0.02em;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.btn-primary {
    background: var(--accent-gold);
    color: #000;
    border-color: var(--accent-gold);
}
.btn-primary:hover {
    background: var(--accent-gold-light);
    border-color: var(--accent-gold-light);
    color: #000;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(201,168,76,0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--accent-white);
    border-color: var(--border-subtle);
}
.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-sm);
}

.action-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    align-items: center;
}

/* ============================================================
   CARD
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    overflow: hidden;
}

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

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-white);
    letter-spacing: 0.01em;
}

.card-body { padding: 20px; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--accent-white);
    font-size: 14px;
    font-family: inherit;
    padding: 10px 14px;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}

.form-control::placeholder { color: var(--text-dim); }

textarea.form-control { min-height: 80px; resize: vertical; }

.form-control[type="file"] {
    padding: 8px 14px;
    cursor: pointer;
}

.form-control[type="file"]::file-selector-button {
    background: var(--accent-gold);
    color: #000;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-right: 10px;
}

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

.form-hint {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 5px;
}

/* ============================================================
   DATA TABLE (DataTables.js dark overrides)
   ============================================================ */
.table-container {
    overflow-x: auto;
}

table.dataTable {
    width: 100% !important;
    border-collapse: collapse;
    background: transparent;
    color: var(--accent-white);
}

table.dataTable thead th {
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

table.dataTable thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
table.dataTable thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }

table.dataTable tbody tr {
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition);
}

table.dataTable tbody tr:hover {
    background: rgba(201,168,76,0.04);
}

table.dataTable tbody td {
    padding: 10px 14px;
    vertical-align: middle;
    font-size: 13px;
    color: var(--accent-white);
}

/* DataTables controls */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    background: var(--bg-input) !important;
    border: 1px solid var(--border-subtle) !important;
    color: var(--accent-white) !important;
    border-radius: var(--radius-sm) !important;
    padding: 6px 10px !important;
    outline: none !important;
    font-family: inherit !important;
    font-size: 13px !important;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--accent-gold) !important;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_info {
    color: var(--text-muted) !important;
    font-size: 12px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    background: var(--bg-input) !important;
    color: var(--text-muted) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-sm) !important;
    padding: 5px 10px !important;
    margin: 0 2px !important;
    font-size: 12px !important;
    cursor: pointer !important;
    transition: all var(--transition) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--accent-gold) !important;
    color: #000 !important;
    border-color: var(--accent-gold) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--accent-gold) !important;
    color: #000 !important;
    border-color: var(--accent-gold) !important;
    font-weight: 700 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.3 !important;
    cursor: default !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background: var(--bg-input) !important;
    color: var(--text-muted) !important;
    border-color: var(--border-subtle) !important;
}

/* Sorting icons color fix */
table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after {
    color: var(--accent-gold) !important;
    opacity: 0.8;
}

/* ============================================================
   PRODUCT IMAGE GRID (dashboard table)
   ============================================================ */
.img-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
    width: 90px;
}

.img-grid .img-cell img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 3px;
    cursor: pointer;
    transition: opacity var(--transition);
}

.img-grid .img-cell img:hover { opacity: 0.8; }

.img-single img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: opacity var(--transition);
}

.img-single img:hover { opacity: 0.8; }

.no-img { color: var(--text-dim); font-size: 18px; }

/* ============================================================
   PRICE DISPLAY
   ============================================================ */
.price-original {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 12px;
}

.price-discount {
    color: var(--accent-gold);
    font-weight: 700;
    font-size: 14px;
}

/* ============================================================
   BADGE / CHIP
   ============================================================ */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.badge-gold { background: rgba(201,168,76,0.15); color: var(--accent-gold); border: 1px solid var(--border-gold); }
.badge-dim  { background: var(--bg-surface); color: var(--text-muted); border: 1px solid var(--border-subtle); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(201,168,76,0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(201,168,76,0.04) 0%, transparent 50%),
        var(--bg-primary);
    padding: 24px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: 12px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo img {
    height: 56px;
    margin: 0 auto 12px;
    object-fit: contain;
}

.login-logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-gold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.login-logo-sub {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-top: 2px;
}

.login-title {
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 28px;
    color: var(--accent-white);
}

.login-error {
    background: rgba(231,76,60,0.1);
    border: 1px solid rgba(231,76,60,0.3);
    border-radius: var(--radius-sm);
    color: #e74c3c;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 20px;
    text-align: center;
}

.login-timeout {
    background: rgba(201,168,76,0.1);
    border: 1px solid rgba(201,168,76,0.3);
    border-radius: var(--radius-sm);
    color: var(--accent-gold);
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 20px;
    text-align: center;
}

.btn-login {
    width: 100%;
    justify-content: center;
    padding: 13px;
    font-size: 14px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-top: 8px;
}

/* ============================================================
   MASTER PICTURES — THUMBNAIL LIST
   ============================================================ */
.pic-list {
    display: grid;
    gap: 1px;
}

.pic-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition);
}

.pic-list-item:hover { background: rgba(255,255,255,0.02); }

.pic-list-thumbs {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.pic-list-thumbs img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid var(--border-subtle);
    transition: border-color var(--transition);
}

.pic-list-thumbs img:hover { border-color: var(--accent-gold); }

.pic-list-info { flex: 1; min-width: 0; }

.pic-list-code {
    font-weight: 700;
    font-size: 14px;
    color: var(--accent-white);
}

.pic-list-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.pic-list-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ============================================================
   SETTINGS PAGE
   ============================================================ */
.settings-section {
    margin-bottom: 32px;
}

.settings-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-gold);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-gold);
}

.cover-preview-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.cover-preview-box img {
    height: 60px;
    width: auto;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.cover-preview-box .no-preview {
    color: var(--text-dim);
    font-size: 12px;
    font-style: italic;
}

/* ============================================================
   ALERTS / STATUS
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: rgba(39,174,96,0.1); border: 1px solid rgba(39,174,96,0.3); color: #2ecc71; }
.alert-danger  { background: rgba(231,76,60,0.1);  border: 1px solid rgba(231,76,60,0.3);  color: #e74c3c; }
.alert-info    { background: rgba(201,168,76,0.1); border: 1px solid var(--border-gold);   color: var(--accent-gold); }

/* ============================================================
   DIVIDER
   ============================================================ */
.divider {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 24px 0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .page-wrapper { padding: 20px 16px; }
    .navbar { padding: 0 16px; }
    .navbar-brand-text { display: none; }
    .action-bar { gap: 8px; }
    .btn { padding: 9px 14px; font-size: 12px; }
    .login-card { padding: 32px 24px; }
    .form-row { grid-template-columns: 1fr; }
}

/* ============================================================
   UTILITY
   ============================================================ */
.text-gold   { color: var(--accent-gold); }
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.fw-bold     { font-weight: 700; }
.text-center { text-align: center; }
.mt-1  { margin-top: 4px; }
.mt-2  { margin-top: 8px; }
.mt-3  { margin-top: 16px; }
.mt-4  { margin-top: 24px; }
.mb-2  { margin-bottom: 8px; }
.mb-3  { margin-bottom: 16px; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.w-100 { width: 100%; }
