/* ========================================
   LELANG KEU - Premium Dark Theme
   ======================================== */

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

/* CSS Variables */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.75);
    --bg-glass: rgba(255, 255, 255, 0.08);
    --bg-glass-hover: rgba(255, 255, 255, 0.12);
    --border-glass: rgba(255, 255, 255, 0.12);
    --border-glass-hover: rgba(255, 255, 255, 0.22);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #38bdf8);
    --accent-glow: rgba(99, 102, 241, 0.4);
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.4);
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.4);
    --warning: #f59e0b;
    --info: #06b6d4;
    --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.25);
    --shadow-md: 0 8px 32px rgba(15, 23, 42, 0.35);
    --shadow-lg: 0 16px 48px rgba(15, 23, 42, 0.45);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.25);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 40%, #0f172a 70%, #1e293b 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding-bottom: 60px;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 20% 25%, rgba(99, 102, 241, 0.18) 0%, transparent 45%),
                radial-gradient(circle at 80% 75%, rgba(139, 92, 246, 0.15) 0%, transparent 45%),
                radial-gradient(circle at 50% 50%, rgba(56, 189, 248, 0.12) 0%, transparent 50%);
    z-index: -1;
    animation: bgFloat 25s ease-in-out infinite;
}

@keyframes bgFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(1%, 2%) rotate(0.5deg); }
    66% { transform: translate(-0.5%, 1%) rotate(-0.5deg); }
}

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

/* ========== NAVBAR ========== */
.navbar {
    background: rgba(30, 41, 59, 0.85) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    padding: 0.8rem 0;
    transition: var(--transition);
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.5rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.navbar .nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    position: relative;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: var(--text-primary) !important;
    background: var(--bg-glass);
}

.navbar .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--accent-gradient);
    border-radius: 1px;
}

.navbar-toggler {
    border: 1px solid var(--border-glass) !important;
    padding: 0.4rem 0.6rem;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(148,163,184,1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* ========== HERO SECTION ========== */
.hero-section {
    padding: 5rem 0 3rem;
    text-align: center;
    position: relative;
}

.hero-section h1 {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    letter-spacing: -1px;
}

.hero-section .subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto 2rem;
}

/* ========== CARDS ========== */
.card, .glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover, .glass-card:hover {
    border-color: var(--border-glass-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}

.card .card-body {
    padding: 1.25rem;
}

.card .card-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
}

.card .card-text {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.card-img-top {
    object-fit: cover;
    height: 200px;
    border-bottom: 1px solid var(--border-glass);
}

.card .no-image-placeholder {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(139,92,246,0.1));
    border-bottom: 1px solid var(--border-glass);
}

.card .no-image-placeholder span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Card price tags */
.price-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.25rem 0.6rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: #a5b4fc;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.price-tag.highest {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

.price-tag .label {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ========== BUTTONS ========== */
.btn-primary,
.btn-accent {
    background: var(--accent-gradient) !important;
    border: none !important;
    color: #fff !important;
    font-weight: 600;
    font-size: 0.88rem;
    padding: 0.55rem 1.4rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-primary:hover,
.btn-accent:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-success {
    background: var(--success) !important;
    border: none !important;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-success:hover {
    box-shadow: 0 4px 20px var(--success-glow);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger) !important;
    border: none !important;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-danger:hover {
    box-shadow: 0 4px 20px var(--danger-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-glass) !important;
    border: 1px solid var(--border-glass) !important;
    color: var(--text-secondary) !important;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--bg-glass-hover) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-glass-hover) !important;
}

.btn-sm {
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
}

/* ========== FORMS ========== */
.form-control,
.form-select {
    background: var(--bg-glass) !important;
    border: 1px solid var(--border-glass) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm);
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 3px var(--accent-glow) !important;
    outline: none;
}

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

.form-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

.form-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ========== TABLES ========== */
.table {
    color: var(--text-primary);
    border-color: var(--border-glass);
}

.table thead th {
    background: rgba(99, 102, 241, 0.1);
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.85rem 1rem;
}

.table tbody td {
    border-color: var(--border-glass);
    padding: 0.8rem 1rem;
    font-size: 0.88rem;
    vertical-align: middle;
}

.table-striped > tbody > tr:nth-of-type(odd) > td {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.table-striped > tbody > tr:nth-of-type(even) > td {
    background: transparent;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover td {
    background: rgba(99, 102, 241, 0.05) !important;
}

.table-responsive {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    overflow: hidden;
}

/* ========== ALERTS ========== */
.alert {
    border-radius: var(--radius-md);
    border: 1px solid;
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.alert-info {
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.2);
    color: #67e8f9;
}

.alert-info a {
    color: #a5b4fc;
    font-weight: 600;
}

/* ========== AUTH PAGES (Login/Register) ========== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(20px);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    animation: fadeSlideUp 0.5s ease-out;
}

.auth-card .auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-card .auth-logo h2 {
    font-weight: 800;
    font-size: 1.8rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-card .auth-logo p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.3rem;
}

.auth-card .card-header {
    background: none !important;
    border: none !important;
    padding: 0 !important;
}

.auth-card .card-body {
    padding: 0 !important;
}

.auth-card .form-control {
    padding: 0.75rem 1rem;
}

.auth-card .btn-primary {
    padding: 0.75rem;
    font-size: 0.95rem;
}

.auth-card .auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.auth-card .auth-footer a {
    color: #a5b4fc;
    font-weight: 600;
    text-decoration: none;
}

.auth-card .auth-footer a:hover {
    color: #c4b5fd;
}

/* ========== DASHBOARD HEADERS ========== */
.dashboard-header {
    padding: 2rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-glass);
}

.dashboard-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
}

.dashboard-header .badge-role {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: var(--accent-gradient);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* Section titles */
.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title .icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

/* ========== STAT CARDS ========== */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--border-glass-hover);
    box-shadow: var(--shadow-glow);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.3rem;
}

/* ========== ITEM DETAIL PAGE ========== */
.item-detail-img {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
    overflow: hidden;
}

.item-detail-img img {
    width: 100%;
    height: auto;
    display: block;
}

.item-info h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.item-info .lead {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.item-info .detail-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-glass);
    font-size: 0.9rem;
}

.item-info .detail-row .label {
    color: var(--text-muted);
    font-weight: 500;
    min-width: 130px;
}

.item-info .detail-row .value {
    color: var(--text-primary);
    font-weight: 600;
}

.item-info .detail-row .value.highlight {
    color: #6ee7b7;
    font-size: 1.1rem;
}

/* Bid form */
.bid-form {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.bid-form h4 {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* ========== COUNTDOWN ========== */
.countdown-box {
    display: flex;
    gap: 0.75rem;
    margin: 1rem 0;
}

.countdown-item {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    text-align: center;
    min-width: 55px;
}

.countdown-item .num {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
    display: block;
}

.countdown-item .unit {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========== STATUS BADGES ========== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.inactive {
    background: rgba(100, 116, 139, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.3);
}

.status-badge.sold {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.animate-in {
    animation: fadeSlideUp 0.5s ease-out both;
}

.animate-in-delay-1 { animation-delay: 0.1s; }
.animate-in-delay-2 { animation-delay: 0.2s; }
.animate-in-delay-3 { animation-delay: 0.3s; }

/* ========== CHART CONTAINER ========== */
#chart {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

/* ========== FOOTER ========== */
.site-footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border-glass);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .hero-section h1 { font-size: 2rem; }
    .hero-section { padding: 3rem 0 2rem; }
    .dashboard-header h1 { font-size: 1.4rem; }
    .auth-card { padding: 1.8rem; }
    .countdown-box { gap: 0.4rem; }
    .countdown-item { min-width: 48px; padding: 0.4rem 0.5rem; }
    .countdown-item .num { font-size: 1.1rem; }
    .item-info .detail-row { flex-direction: column; align-items: flex-start; gap: 0.2rem; }
    .item-info .detail-row .label { min-width: auto; }
    .stat-card .stat-value { font-size: 1.5rem; }
    .card-img-top { height: 160px; }
}

@media (max-width: 576px) {
    .hero-section h1 { font-size: 1.6rem; }
    .container { padding-left: 1rem; padding-right: 1rem; }
    .navbar-brand { font-size: 1.25rem; }
}

/* ========== TABLE STYLING & SCROLL OVERFLOW ========== */
.table-responsive {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.table-responsive table {
    width: 100% !important;
    min-width: 950px !important;
}
.table-responsive::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}
.table-responsive::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}
.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 3px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}

/* ========== UTILITIES ========== */
.text-gradient {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
}

.glow-border {
    border-color: var(--accent-primary) !important;
    box-shadow: var(--shadow-glow);
}

/* SweetAlert Dark Theme Override */
.swal2-popup {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg) !important;
    color: var(--text-primary) !important;
}

.swal2-title { color: var(--text-primary) !important; }
.swal2-html-container { color: var(--text-secondary) !important; }
.swal2-confirm { background: var(--accent-gradient) !important; border: none !important; border-radius: var(--radius-sm) !important; }
.swal2-cancel { background: var(--bg-glass) !important; border: 1px solid var(--border-glass) !important; color: var(--text-secondary) !important; border-radius: var(--radius-sm) !important; }

/* ApexCharts Dark Override */
.apexcharts-text { fill: var(--text-secondary) !important; }
.apexcharts-gridline { stroke: var(--border-glass) !important; }
.apexcharts-tooltip { background: var(--bg-secondary) !important; border: 1px solid var(--border-glass) !important; color: var(--text-primary) !important; }
.apexcharts-tooltip-title { background: var(--bg-glass) !important; border-bottom: 1px solid var(--border-glass) !important; }
