/* ==========================================================================
   1. GLOBAL VARIABLES & BASE RESET
   ========================================================================== */
:root {
    --brand-gold: #DD9933;
    --brand-gold-dark: #b57d26;
    --brand-gold-accent: #b8962e;
    --dark-slate: #1e293b;
    --light-slate: #f8fafc;
    --border-color: #e2e8f0;
    --text-main: #374151;
    --text-muted: #64748b;
    --success-bg: #dcfce7;
    --success-text: #15803d;
    --danger-bg: #fee2e2;
    --danger-text: #b91c1c;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

body {
    background-color: #cbd5e1;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    width: 100%;
}

.page-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Base Form Inputs */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
input[type="file"],
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, select:focus {
    border-color: var(--brand-gold-accent);
    box-shadow: 0 0 0 3px rgba(184, 150, 46, 0.25);
}

/* Standard Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease, opacity 0.2s ease, transform 0.1s ease;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background-color: var(--brand-gold-accent);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
}
.btn-primary:hover { background-color: var(--brand-gold-dark); }

.btn-secondary {
    background-color: #6b7280;
    color: #ffffff;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}
.btn-secondary:hover { background-color: #4b5563; }

.btn-back {
    padding: 8px 16px;
    background: #64748b;
    color: #ffffff;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s ease;
}
.btn-back:hover { background: #475569; }

.btn-full { width: 100%; }

/* History Link / Admin Nav Section Wrapper */
.admin-nav-actions {
    margin-bottom: 25px;
    display: flex;
    justify-content: flex-end; /* Aligns button neatly to the right */
}

/* Polished Secondary Action Button */
.btn-history {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: var(--dark-slate);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.btn-history:hover {
    background-color: var(--brand-gold-accent);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(184, 150, 46, 0.3);
}

.btn-history:active {
    transform: translateY(0);
}

/* ==========================================================================
   2. GLOBAL HEADER & NAVIGATION STYLES
   ========================================================================== */
#kdhjb-custom-header {
    background-color: var(--brand-gold);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    height: 90px;
    width: 100%;
    border-bottom: 4px solid var(--brand-gold-dark);
    position: relative;
    z-index: 1000;
}

#kdhjb-custom-header .logo-box img { height: 70px; width: auto; display: block; }
#kdhjb-custom-header .text-box { flex-grow: 1; padding-left: 20px; color: #ffffff; }

.header-title { font-size: 1.1rem; display: block; letter-spacing: 0.5px; }
.header-sub { font-size: 0.75rem; display: block; opacity: 0.95; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-header-logout {
    background-color: #dc2626;
    color: #ffffff;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 5px;
    border: 1px solid #b91c1c;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn-header-logout:hover { background-color: #b91c1c; }
.btn-header-logout:active { transform: scale(0.97); }

.menu-trigger {
    background: transparent;
    border: 2px solid #ffffff;
    color: #ffffff;
    font-size: 24px;
    padding: 4px 12px;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.menu-trigger:hover { background: rgba(255, 255, 255, 0.2); }

.header-dropdown {
    display: none;
    position: absolute;
    top: 90px;
    right: 0;
    width: 220px;
    background-color: var(--brand-gold);
    border: 1px solid var(--brand-gold-dark);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 9999;
}

.header-dropdown.show { display: block; }

.header-dropdown a {
    display: block;
    padding: 14px 20px;
    color: #ffffff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    text-align: center;
    font-weight: 500;
    transition: background 0.2s ease;
}

.header-dropdown a:hover { background-color: var(--brand-gold-dark); }

/* Banners & Alerts */
.alert-success, .alert-danger {
    padding: 12px 20px;
    border-radius: 6px;
    margin: 15px auto;
    max-width: 1200px;
    font-weight: bold;
    text-align: center;
}

.alert-success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

.welcome-banner {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #ffffff;
    padding: 20px 25px;
    margin: 20px auto;
    max-width: 1200px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-left: 6px solid #eab308;
}

.welcome-content h2 { margin: 0 0 5px 0; font-size: 1.5rem; font-weight: 600; }
.welcome-content h2 span { color: #facc15; }
.welcome-content p { margin: 0; font-size: 0.95rem; color: #cbd5e1; }

/* ==========================================================================
   3. LOGIN INTERFACE (views/login.php)
   ========================================================================== */
.login-body { 
    /* Remove justify-content: center from body so header stays at top */
    justify-content: flex-start; 
    align-items: stretch;
}

.login-container {
    width: 100%;
    flex: 1; /* Expands to fill the rest of the vertical screen space */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 450px;
    background: #ffffff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border-top: 5px solid var(--brand-gold);
}

.login-header { text-align: center; margin-bottom: 1.5rem; }
.login-header h2 { color: var(--text-main); font-size: 1.5rem; margin-bottom: 0.25rem; }
.login-header p { color: var(--text-muted); font-size: 0.875rem; }
.login-form .form-group { margin-bottom: 1.25rem; }
.login-form label { display: block; font-weight: 600; margin-bottom: 0.5rem; color: var(--text-main); }

.btn-login {
    width: 100%;
    padding: 12px;
    background-color: var(--brand-gold-accent);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-login:hover { background-color: var(--brand-gold-dark); }

/* ==========================================================================
   4. MEMBER BIDDING VIEW (views/bidding.php)
   ========================================================================== */
.auction-grid {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    width: 100%;
}

.auction-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}

.image-frame {
    width: 100%;
    height: 180px;
    background-color: #f1f5f9;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.image-frame img { width: 100%; height: 100%; object-fit: cover; }
.no-image-placeholder { color: #94a3b8; font-size: 0.875rem; }

.card-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.ref-code {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: bold;
    text-transform: uppercase;
}

.package-title {
    font-size: 1.1rem;
    color: #1e293b;
    margin: 5px 0 10px 0;
}

.base-price, .highest-bid {
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.highest-bid strong {
    color: var(--brand-gold-accent);
    font-size: 1rem;
}

.expiry-date {
    margin-top: auto;
    padding-top: 10px;
    color: #64748b;
}

.btn-bid {
    margin-top: 15px;
    width: 100%;
    padding: 10px;
    background-color: var(--brand-gold-accent);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-bid:hover { background-color: var(--brand-gold-dark); }

.winner-announcement-container {
    margin-bottom: 25px;
}
.winner-card {
    background: #f0fdf4;
    border: 2px solid #22c55e;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(34, 197, 94, 0.15);
}
.winner-card h3 { color: #15803d; margin-bottom: 8px; }
.winner-instruction { font-size: 0.9rem; color: #166534; margin-top: 5px; }

/* Bid Status Badges & Timestamp */
.bid-timestamp {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 4px;
    margin-bottom: 8px;
}
.user-bid-status { margin: 8px 0; }
.badge-status-winning {
    display: block;
    background: var(--success-bg);
    color: var(--success-text);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: bold;
}
.badge-status-outbid {
    display: block;
    background: #fef3c7;
    color: #92400e;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: bold;
}

/* ==========================================================================
   5. FLOATING POP-UP MODAL DIALOG
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%;
    background-color: rgba(2, 6, 23, 0.65);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #ffffff;
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    padding: 25px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border-top: 5px solid var(--brand-gold);
    margin: auto;
    animation: modalPopIn 0.25s ease-out;
}

@keyframes modalPopIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.close-modal {
    position: absolute;
    top: 15px; right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
}

.modal-title { color: #1e293b; font-size: 1.25rem; margin-bottom: 15px; }

.modal-items-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 20px;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 0;
}

.modal-item-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.modal-item-thumb img { width: 50px; height: 50px; object-fit: cover; border-radius: 6px; }
.modal-item-details p { font-size: 0.85rem; color: #334155; }

.btn-submit-bid {
    width: 100%;
    padding: 12px;
    background-color: var(--brand-gold-accent);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 10px;
}

.btn-submit-bid:hover { background-color: var(--brand-gold-dark); }

.bid-hint-text {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.btn-submit-bid:disabled {
    background-color: #94a3b8 !important;
    cursor: not-allowed;
    opacity: 0.7;
}

/* ==========================================================================
   6. ADMIN DASHBOARD & FORM CREATION (views/admin.php & utility/create.php)
   ========================================================================== */
.admin-main {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    width: 100%;
}

.form-container {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    border-top: 5px solid var(--brand-gold);
    margin-bottom: 30px;
}

.metadata-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.form-group, .input-field {
    display: flex;
    flex-direction: column;
}

.form-group label, .input-field label {
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--text-main);
}

.items-section {
    background-color: var(--light-slate);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 25px;
}

.items-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: var(--dark-slate);
}

.item-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    align-items: end;
    background: #ffffff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid #cbd5e1;
    position: relative;
}

.btn-remove {
    position: absolute;
    top: 5px; right: 10px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--danger-text);
    cursor: pointer;
}

.actions-section { margin-top: 20px; }

/* ==========================================================================
   7. ADMIN UTILITIES & TABLES (active.php, pending_completion.php, history.php)
   ========================================================================== */
.admin-utility-section {
    margin-top: 30px;
}

.utility-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.utility-section-header h3 {
    color: var(--dark-slate);
    margin: 0;
}

.utility-counter {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.table-card {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.data-table th {
    background: var(--dark-slate);
    color: #ffffff;
    padding: 12px 15px;
    font-weight: 600;
}

.data-table tr.header-slate-dark th {
    background: #334155;
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.col-highlight {
    font-weight: bold;
    color: #0f172a;
}

.col-price-success {
    font-weight: bold;
    color: #16a34a;
}

.col-expiry-danger {
    color: #dc2626;
    font-size: 13px;
}

.col-date-muted {
    color: var(--text-muted);
    font-size: 13px;
}

.bidder-info {
    line-height: 1.3;
}

.bidder-info strong {
    color: var(--dark-slate);
}

.bidder-info small {
    color: var(--text-muted);
}

.text-no-bid {
    color: #94a3b8;
    font-style: italic;
}

.text-unsold {
    color: #dc2626;
    font-weight: 500;
}

.text-muted-normal {
    color: var(--text-muted);
    font-weight: normal;
}

.text-center { text-align: center; }

.table-empty-row {
    padding: 25px;
    text-align: center;
    color: var(--text-muted);
}

/* Action Buttons & Badges */
.inline-form-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn-action-success {
    background: #16a34a;
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: background 0.2s ease;
}
.btn-action-success:hover { background: #15803d; }

.btn-action-danger {
    background: #ef4444;
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: background 0.2s ease;
}
.btn-action-danger:hover { background: #b91c1c; }

.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 12px;
    display: inline-block;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
}

/* ==========================================================================
   8. LIGHTBOX IMAGE OVERLAY
   ========================================================================== */
.lightbox-overlay {
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100vw !important; height: 100vh !important;
    background-color: rgba(2, 6, 23, 0.9) !important;
    backdrop-filter: blur(8px);
    z-index: 999999 !important;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 85vh;
}

.lightbox-image-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.lightbox-image-wrapper img {
    max-width: 75vw;
    max-height: 65vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    border: 3px solid var(--brand-gold);
}

.lightbox-caption {
    color: #ffffff;
    margin-top: 12px;
    font-size: 0.95rem;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.75);
    padding: 8px 18px;
    border-radius: 20px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.lightbox-close {
    position: fixed;
    top: 20px; right: 30px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-size: 2rem;
    width: 45px; height: 45px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000000;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-close:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
}

.lightbox-nav {
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 2rem;
    width: 50px; height: 50px;
    cursor: pointer;
    border-radius: 50%;
    margin: 0 20px;
    user-select: none;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-nav:hover {
    background: var(--brand-gold);
    color: #020617;
    border-color: var(--brand-gold);
}