:root {
    --bg-color: #f5f5f7;
    --text-color: #1d1d1f;
    --card-bg: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 16px;
    --transition: all 0.3s ease;

    /* Bank Themes */
    --next-primary: #FFFF05;
    --next-text: #000000;

    --sinopac-primary: #CEB073;
    --sinopac-secondary: #221B11;
    --sinopac-text: #ffffff;

    --first-primary: #15402A;
    --first-text: #ffffff;

    --cathay-primary: #038B42;
    --cathay-text: #ffffff;

    --esun-primary: #049993;
    --esun-text: #ffffff;

    --ipass-primary: #4FB802;
    --ipass-text: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Noto Sans TC', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
}

/* Layout */
.main-content {
    padding-top: 80px;
    /* Space for fixed navbar */
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.container {
    max-width: 800px;
    /* Limit width for better readability on large screens */
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    /* Stack vertically */
    gap: 40px;
    /* Increase gap for distinct sections */
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.menu-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 16px;
    color: var(--text-color);
}

.navbar h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background: var(--card-bg);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 200;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    left: 0;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.sidebar-nav {
    padding: 20px 0;
    overflow-y: auto;
}

.nav-link {
    display: block;
    padding: 12px 24px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: background 0.2s;
}

.nav-link:hover {
    background-color: #f0f0f0;
}

#close-sidebar {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #666;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Bank Cards */
.bank-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    scroll-margin-top: 80px;
}

.bank-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.bank-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bank-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.bank-code {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
}

.bank-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.account-info {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.03);
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
}

.account-info:hover {
    background: rgba(0, 0, 0, 0.06);
}

.account-info .label {
    display: block;
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 4px;
}

.account-info .number {
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.qr-code-container {
    width: 200px;
    height: 200px;
    background: #fff;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.qr-code-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Theme Specifics */
.next-theme .bank-header {
    background-color: var(--next-primary);
    color: var(--next-text);
}

.next-theme .account-info .number {
    color: #333;
}

.sinopac-theme .bank-header {
    background-color: var(--sinopac-primary);
    color: var(--sinopac-secondary);
}

.sinopac-theme .bank-body {
    background: linear-gradient(to bottom, #fff, #fafafa);
}

.first-theme .bank-header {
    background-color: var(--first-primary);
    color: var(--first-text);
}

.cathay-theme .bank-header {
    background-color: var(--cathay-primary);
    color: var(--cathay-text);
}

.esun-theme .bank-header {
    background-color: var(--esun-primary);
    color: var(--esun-text);
}

.ipass-theme .bank-header {
    background-color: var(--ipass-primary);
    color: var(--ipass-text);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.9rem;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Responsive */
/* Bookmarks Section */
.bookmarks-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.bookmarks-section h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-color);
}

.bookmarks-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.bookmark-btn {
    padding: 10px 20px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: transform 0.2s, box-shadow 0.2s;
    color: #fff;
}

.bookmark-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.next-btn {
    background-color: var(--next-primary);
    color: var(--next-text);
}

.sinopac-btn {
    background-color: var(--sinopac-primary);
    color: var(--sinopac-secondary);
}

.first-btn {
    background-color: var(--first-primary);
}

.cathay-btn {
    background-color: var(--cathay-primary);
}

.esun-btn {
    background-color: var(--esun-primary);
}

.ipass-btn {
    background-color: var(--ipass-primary);
}

/* Responsive & Sidebar Logic */
@media (min-width: 1024px) {
    .sidebar {
        left: 0;
        /* Always visible on desktop */
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    }

    .main-content {
        margin-left: 280px;
        /* Push content */
        padding-top: 40px;
        /* Less padding since navbar might be hidden or different */
    }

    .navbar {
        display: none;
        /* Hide mobile navbar on desktop */
    }

    .overlay {
        display: none !important;
        /* No overlay on desktop */
    }

    #close-sidebar {
        display: none;
        /* Hide close button on desktop */
    }
}

@media (max-width: 1023px) {
    .container {
        grid-template-columns: 1fr;
    }
}