:root {
    /* Pink Tone Theme (Start) */
    --primary: #EC4899; /* Pink 500 - Vibrant Pink */
    --primary-glow: rgba(236, 72, 153, 0.4);
    --accent: #F472B6; /* Pink 400 */
    --bg-deep: #FDF2F8; /* Pink 50 */
    /* Romantic Pink Gradient */
    --bg-gradient: linear-gradient(135deg, #FBCFE8 0%, #F472B6 100%); 
    
    /* High Visibility Glass (White Frosted) */
    --glass: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(255, 255, 255, 0.95);
    --glass-heavy: rgba(255, 255, 255, 0.98);
    
    /* High Contrast Text */
    --text-main: #831843; /* Pink 900 - Deep Maroon */
    --text-dim: #BE185D; /* Pink 700 - Dark Pink */
    
    /* Status Colors (Softer) */
    --success: #10B981; /* Emerald */
    --danger: #EF4444; /* Red */
    --warning: #F59E0B; /* Amber */
    --info: #3B82F6; /* Blue */
    
    --sidebar-width: 280px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Sarabun', sans-serif;
    background: var(--bg-deep); /* Fallback */
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-main);
    overflow-x: hidden;
    padding-top: 100px;
    padding-bottom: 40px;
}

/* Base Link & text utilities */
a { text-decoration: none; }

/* Navbar */
.navbar {
    background: linear-gradient(135deg, #831843, #BE185D); /* Deep Rose Gradient */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(131, 24, 67, 0.25);
}

.navbar.scrolled {
    padding: 10px 0;
    background: linear-gradient(135deg, #831843, #BE185D);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.navbar-brand img {
    height: 45px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

.navbar-toggler {
    color: white !important;
    padding: 8px;
    transition: transform 0.3s ease;
}

.navbar-toggler:focus {
    box-shadow: none;
}

.navbar-toggler:active {
    transform: scale(0.9);

}

.navbar-brand:hover img {
    transform: scale(1.05);
}

.navbar-brand span {
    color: white;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: none;
    -webkit-text-fill-color: white;
}

.nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    padding: 10px 18px !important;
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    font-size: 0.95rem;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: all 0.3s ease;
    transform: translateX(-50%);
    box-shadow: 0 0 10px var(--primary);
}

.nav-link:hover, .nav-link.active {
    color: white !important;
}

.nav-link:hover::after, .nav-link.active::after {
    width: 20px;
}

/* Stat Value Utility */
.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

/* Glass Card Utility */
.glass-card {
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    transform: translateY(-5px);
    background: var(--glass-heavy);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Buttons */
.btn-glass {
    background: var(--glass-heavy);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: 16px;
    font-weight: 600;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.btn-glass:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--primary-glow);
}

.btn-glass.primary {
    background: var(--primary);
    color: white;
}

.btn-glass.danger {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-glass.danger:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.4);
}

/* Hero Section (Common elements) */
.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 24px;
    color: var(--text-main);
}

.hero-highlight {
    color: var(--text-dim);
    display: block;
}

.btn-hero {
    padding: 16px 40px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.btn-hero-primary {
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 10px 30px -5px var(--primary-glow);
}

.btn-hero-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px -5px var(--primary-glow);
    background: #4f46e5;
    color: white;
}

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Mobile Dock (Bottom Navigation) */
.mobile-dock {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #831843, #BE185D); /* Deep Rose Gradient */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 8px 24px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 24px;
    z-index: 1000;
    box-shadow: 0 20px 50px -10px rgba(131, 24, 67, 0.4);
}

.dock-item {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.25rem;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dock-item:hover, .dock-item.active {
    color: white;
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px);
}

.dock-item:hover i, .dock-item.active i {
    transform: translateY(-3px);
}

/* Sidebar (Desktop) */
.sidebar {
    position: sticky;
    top: 24px;
    height: calc(100vh - 48px);
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-dim);
    text-decoration: none;
    border-radius: 16px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.sidebar-item:hover, .sidebar-item.active {
    background: var(--glass-heavy);
    color: white;
    transform: translateX(5px);
}

.sidebar-item.active i {
    color: var(--primary);
}

/* Tables */
.table-glass {
    color: var(--text-main);
    border-collapse: separate;
    border-spacing: 0 8px;
    width: 100%;
}

.table-glass thead th {
    border: none;
    color: var(--text-dim);
    font-weight: 600;
    padding: 12px 15px; /* Reduced from 20px */
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.table-glass tbody tr {
    background: var(--glass);
    transition: all 0.3s ease;
}

.table-glass tbody tr:hover {
    background: var(--glass-heavy);
    transform: scale(1.005);
}

.table-glass tbody td {
    border: none;
    padding: 12px 15px; /* Reduced padding for better fit */
    vertical-align: middle;
    word-wrap: break-word;
    min-width: 80px;
}

.table-glass tbody td:first-child { border-radius: 16px 0 0 16px; }
.table-glass tbody td:last-child { border-radius: 0 16px 16px 0; }

/* Badges */
.badge-modern {
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-success { background: rgba(16, 185, 129, 0.1); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.2); }

/* Forms */
.form-label {
    color: var(--text-dim);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
}

.input-modern, .form-control-glass {
    width: 100%;
    background: rgba(0, 0, 0, 0.03); /* Subtle dark fill for visibility on light glass */
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    padding: 14px 16px;
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-modern:focus, .form-control-glass:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.8);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
    color: var(--text-main);
}

/* Receipt Style Container */
.receipt-container {
    max-width: 800px;
    margin: 0 auto;
}

.receipt-header {
    text-align: center;
    margin-bottom: 40px;
}

.receipt-icon {
    width: 80px;
    height: 80px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 20px;
    box-shadow: 0 0 30px var(--primary-glow);
}

.status-badge {
    padding: 8px 16px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.status-paid {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-unpaid {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.info-label {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.info-value {
    color: var(--text-main);
    font-weight: 600;
    font-size: 1.1rem;
}

/* Breakdown Table */
.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--glass-border);
}

.breakdown-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.breakdown-label {
    color: var(--text-dim);
}

.breakdown-value {
    font-weight: 700;
    color: var(--text-main);
}

.total-row {
    margin-top: 20px;
    padding: 24px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-label {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
}

.total-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-main);
    text-shadow: 0 0 15px var(--primary-glow);
}

/* Responsive Utils */
@media (max-width: 991px) {
    .sidebar { display: none; }
    body { padding-bottom: 100px; } /* Space for mobile dock */
    
    /* Mobile Navbar Styling */
    .navbar-collapse {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        margin-top: 15px;
        padding: 20px;
        border-radius: 20px;
        border: 1px solid white;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    }
    
    .nav-link {
        margin: 10px 0;
        padding: 10px !important;
        border-radius: 12px;
    }
    
    .nav-link:hover, .nav-link.active {
        background: var(--glass);
    }
    
    .nav-link::after {
        display: none; /* Remove underline effect on mobile */
    }

    /* Responsive Table to Cards */
    .table-responsive {
        border: none;
        overflow-x: visible;
    }

    .table-glass.text-nowrap {
        white-space: normal !important;
    }

    .table-glass, 
    .table-glass thead, 
    .table-glass tbody, 
    .table-glass th, 
    .table-glass td, 
    .table-glass tr { 
        display: block; 
    }

    .table-glass thead tr { 
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .table-glass tbody tr {
        margin-bottom: 1.5rem;
        background: var(--glass-heavy);
        border: 1px solid var(--glass-border);
        border-radius: 20px;
        padding: 15px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.05);
        position: relative;
    }

    .table-glass tbody tr.border-primary {
        border-width: 2px !important;
    }

    .table-glass td { 
        border: none;
        position: relative;
        padding-left: 45% !important; 
        text-align: left !important;
        padding-top: 10px !important;
        padding-bottom: 10px !important;
        border-bottom: 1px solid rgba(0,0,0,0.03);
        min-height: 45px;
        display: flex;
        align-items: center;
        justify-content: flex-start;
    }

    .table-glass td:last-child {
        border-bottom: none;
    }

    .table-glass td:before { 
        position: absolute;
        top: 50%;
        left: 15px;
        transform: translateY(-50%);
        width: 40%; 
        padding-right: 10px; 
        white-space: nowrap;
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-dim);
        font-size: 0.85rem;
        text-align: left;
    }

    .table-glass tfoot {
        display: block;
        margin-top: 2rem;
    }

    .table-glass tfoot tr {
        display: block;
        background: var(--primary);
        color: white;
        border-radius: 20px;
        padding: 20px;
    }

    .table-glass tfoot td {
        display: flex;
        justify-content: space-between;
        padding: 8px 0 !important;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        padding-left: 0 !important;
        text-align: right !important;
    }

    .table-glass tfoot td:before {
        content: attr(data-label);
        color: rgba(255,255,255,0.8);
        font-weight: 500;
        position: static;
        transform: none;
        width: auto;
    }

    .table-glass tfoot td:empty,
    .table-glass tfoot td:first-child:empty {
        display: none;
    }

    .table-glass tfoot td:first-child {
        justify-content: center;
        font-size: 1.1rem;
        border-bottom: 2px solid rgba(255,255,255,0.2);
        margin-bottom: 10px;
        padding-bottom: 15px !important;
    }
}

@media (max-width: 768px) {
    /* Hero Adjustments */
    .hero-section {
        padding-top: 100px;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    /* Stats Grid - Allow 1 column on very small screens, 2 on others */
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 16px;
    }

    .stat-number {
        font-size: 2rem;
    }
    
    .stat-card {
        padding: 20px;
    }

    .footer-links {
        flex-direction: column;
        gap: 15px;
    }
}

/* Download Page Styles */
.download-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 30px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.download-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #F472B6);
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Logout Page Styles */
.logout-card {
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 50px 40px;
    text-align: center;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    position: relative;
    margin: auto; /* Center in flex container */
}

.logout-icon {
    font-size: 3.5rem;
    color: var(--primary);
    margin-bottom: 25px;
    filter: drop-shadow(0 0 15px var(--primary-glow));
    animation: pulse 2s infinite ease-in-out;
}

.loading-ring {
    display: inline-block;
    width: 50px;
    height: 50px;
    margin-bottom: 20px;
    border: 3px solid rgba(236, 72, 153, 0.2); /* Pink tint */
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

.progress-bar-container {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    margin-top: 30px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 2.2s linear;
    box-shadow: 0 0 10px var(--primary-glow);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* Full screen center utility for logout/login */
.min-vh-100-center {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.download-card:hover {
    background: var(--glass-heavy);
    transform: translateY(-10px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
}

.download-card:hover::before {
    opacity: 1;
}

.download-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.1);
    margin-bottom: 24px;
    font-size: 2rem;
    color: var(--primary);
    transition: all 0.3s ease;
}

.download-card:hover .download-icon-wrapper {
    background: var(--primary);
    color: white;
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 10px 20px -5px var(--primary-glow);
}

.download-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.4;
    color: var(--text-main);
}

.download-desc {
    font-size: 0.95rem;
    color: var(--text-dim);
    margin-bottom: 24px;
    line-height: 1.6;
    flex-grow: 1;
}

.download-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
}

.download-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.download-meta i {
    color: var(--primary);
}

.download-btn-full {
    width: 100%;
    justify-content: center;
    padding: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    font-weight: 600;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.download-btn-full:hover {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 5px 15px var(--primary-glow);
    transform: translateY(-2px);
}

@media (min-width: 992px) {
    .mobile-dock { display: none; }
}

@media print {
    .no-print { display: none !important; }
    body { background: white !important; color: black !important; padding: 0 !important; }
    .glass-card { box-shadow: none; border: 1px solid #ddd; backdrop-filter: none; background: white !important; }
    .total-row { background: #f8fafc !important; }
    .text-white { color: black !important; }
    .text-dim { color: #666 !important; }
    
    /* Receipt Print Specifics */
    .info-label { color: #64748b !important; }
    .info-value, .breakdown-value, .total-value { color: black !important; }
}
/* Stat Card Premium */
.stat-card-premium {
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.stat-card-premium::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--card-accent, var(--primary));
    opacity: 0.5;
}

.stat-card-premium:hover {
    transform: translateY(-8px);
    background: var(--glass-heavy);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.2);
}

.stat-card-premium .stat-icon {
    width: 60px;
    height: 60px;
    background: rgba(var(--icon-rgb, 236, 72, 153), 0.1);
    color: var(--card-accent, var(--primary));
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 16px;
    transition: all 0.4s ease;
}

.stat-card-premium:hover .stat-icon {
    background: var(--card-accent, var(--primary));
    color: white;
    transform: scale(1.1) rotate(5deg);
}

.stat-card-premium .stat-number {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-card-premium .stat-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}
