/* Sunway Lagoon Water Park Theme - Light & Dark Mode */
:root {
    /* Main Sunway Lagoon Colors */
    --sunway-blue: #012066;
    --water-blue: #0ea5e9;
    --water-light: #e0f2fe;
    
    /* Light Theme (Water Park Default) */
    --bg-color: #f0f9ff; /* Very light water blue */
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border-color: #bae6fd;
    --primary: var(--sunway-blue);
    --primary-hover: #022c8a;
    --secondary: var(--water-blue);
    --glass: rgba(255, 255, 255, 0.9);
    --input-bg: #f8fafc;
}

[data-theme="dark"] {
    /* Dark Theme */
    --bg-color: #020617;
    --sidebar-bg: #0f172a;
    --card-bg: rgba(15, 23, 42, 0.6);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: rgba(14, 165, 233, 0.2);
    --primary: var(--water-blue);
    --primary-hover: #38bdf8;
    --secondary: #0284c7;
    --glass: rgba(15, 23, 42, 0.7);
    --input-bg: rgba(255, 255, 255, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    font-size: 14px;
    transition: background-color 0.3s, color 0.3s;
    background-image: linear-gradient(135deg, var(--water-light) 0%, var(--bg-color) 100%);
}

[data-theme="dark"] body {
    background-image: none;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--secondary); border-radius: 10px; }

/* Layout */
.app-container {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    box-shadow: 2px 0 10px rgba(1, 32, 102, 0.05);
}

.main-content {
    padding: 2rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* Navigation */
.sidebar-header { margin-bottom: 2rem; }

.sidebar-nav {
    list-style: none !important;
    padding: 0;
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    gap: 0.75rem;
    border-radius: 12px;
    color: var(--text-secondary) !important;
    text-decoration: none !important;
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
}

.nav-link:hover, .nav-link.active {
    background: var(--primary) !important;
    color: white !important;
    transform: translateX(4px);
    box-shadow: 0 4px 10px rgba(1, 32, 102, 0.1);
}

a {
    text-decoration: none !important;
    color: var(--secondary);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    box-shadow: 0 4px 15px rgba(1, 32, 102, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.15);
    border-color: var(--secondary);
}

/* Vault Items */
.vault-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.vault-card {
    padding: 1.5rem;
    border-radius: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(1, 32, 102, 0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.vault-card:before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.vault-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.15);
    border-color: var(--secondary);
}

.vault-card:hover:before {
    opacity: 1;
}

.vault-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.vault-user { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.5rem; }

/* Vault Card Interior Actions */
.vault-password-container {
    display: flex;
    background: var(--input-bg);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: border-color 0.3s;
}

.vault-password-container:focus-within {
    border-color: var(--secondary);
}

.vault-password-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: transparent;
    border: none;
    font-size: 1rem;
    font-family: 'Inter', monospace;
    color: var(--text-primary);
    outline: none;
}

.vault-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0 0.8rem;
    cursor: pointer;
    transition: color 0.3s;
    font-size: 1rem;
}

.vault-icon-btn:hover {
    color: var(--primary);
}

/* Form Elements & Buttons */
input, textarea, select {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    width: 100%;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus, textarea:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white !important;
    box-shadow: 0 4px 10px rgba(1, 32, 102, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(14, 165, 233, 0.3);
}

.btn-secondary {
    background: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

/* Header & Theme Toggle */
.theme-toggle {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: var(--border-color);
    transform: rotate(15deg);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(1, 32, 102, 0.4);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    width: 100%;
    max-width: 450px;
    transform: scale(0.95);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 20px 40px rgba(1, 32, 102, 0.15);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.form-group { margin-bottom: 1rem; }

/* Login Page Styling */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, var(--water-light) 0%, #ffffff 100%);
}

[data-theme="dark"] .login-container {
    background: var(--bg-color);
}

.login-card {
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    padding: 3rem;
    border-radius: 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(1, 32, 102, 0.1);
}

.login-logo {
    max-width: 140px;
    height: auto;
    margin-bottom: 1.5rem;
}

.login-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Dashboard Header Styles */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 3rem;
    gap: 1.5rem;
}

.search-bar {
    position: relative;
    width: 320px;
}

.header-actions {
    display: flex; 
    align-items: center; 
    gap: 1rem;
}

.sidebar-footer {
    margin-top: auto; 
    border-top: 1px solid var(--border-color); 
    padding-top: 1.5rem;
}

.add-item-li {
    margin-top: 2rem;
}

/* Responsiveness - Mobile App Look */
@media (max-width: 900px) {
    .app-container {
        display: block;
        padding-bottom: 80px; /* Leave space for bottom nav */
    }
    
    .sidebar {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0;
        width: 100%;
        height: 70px;
        flex-direction: row;
        align-items: center;
        padding: 0;
        border-top: 1px solid var(--border-color);
        border-right: none;
        z-index: 1000;
        background: var(--sidebar-bg); /* Opaque so passwords don't show behind */
        box-shadow: 0 -4px 15px rgba(1, 32, 102, 0.1);
    }
    
    .sidebar-header {
        display: none !important;
    }
    
    .sidebar-nav {
        display: flex;
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        width: 100%;
        height: 100%;
        padding: 0 0.5rem;
    }
    
    .nav-item {
        margin: 0 !important;
        flex: 1;
        display: flex;
        justify-content: center;
    }
    
    .nav-link {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 0.5rem;
        font-size: 0.7rem;
        font-weight: 600;
        gap: 0.3rem;
        margin-bottom: 0;
        border-radius: 0;
        text-align: center;
        background: transparent !important;
        color: var(--text-secondary) !important;
    }
    
    .nav-link i {
        font-size: 1.4rem;
        margin-bottom: 2px;
    }

    .nav-link.active {
        color: var(--primary) !important;
        background: rgba(14, 165, 233, 0.15) !important;
        border-radius: 12px !important;
        box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.2) !important;
        padding: 0.5rem 0; /* Add visual weight */
    }
    
    .nav-link.active i {
        color: var(--primary) !important;
    }

    .nav-link:hover {
        transform: translateY(-2px);
        box-shadow: none !important;
        background: transparent !important;
        color: var(--primary) !important;
    }
    
    .modal {
        padding: 1.25rem !important;
        width: 92% !important;
        max-width: 360px !important;
        max-height: 80vh !important;
        overflow-y: auto !important;
        border-radius: 16px !important;
    }
    
    .modal h2 {
        font-size: 1.25rem !important;
        margin-bottom: 1rem !important;
    }
    
    .modal .form-group {
        margin-bottom: 0.75rem !important;
    }
    
    .modal input, .modal textarea, .modal select {
        padding: 0.6rem 0.75rem !important;
        font-size: 0.85rem !important;
    }
    
    .modal .btn {
        padding: 0.6rem 1rem !important;
        font-size: 0.85rem !important;
    }
    
    /* Login Page Mobile */
    .login-container {
        padding: 1rem !important;
        align-items: center !important;
    }
    
    .login-card {
        padding: 1.5rem !important;
        border-radius: 16px !important;
    }
    
    .login-logo {
        max-width: 100px !important;
        margin-bottom: 1rem !important;
    }
    
    .login-title {
        font-size: 1.6rem !important;
        margin-bottom: 0.25rem !important;
    }
    
    .sidebar-footer {
        display: none !important;
    }
    
    .main-content {
        padding: 1rem 1rem 2rem 1rem;
    }

    .dashboard-header {
        flex-direction: column !important; /* Stack blocks vertically */
        align-items: stretch !important;
        gap: 1.5rem;
        margin-bottom: 2rem;
        background: var(--sidebar-bg);
        padding: 1.5rem;
        border-radius: 20px;
        box-shadow: 0 4px 15px rgba(1, 32, 102, 0.05);
    }
    
    .header-titles {
        display: flex;
        flex-direction: column; /* Stack title and description vertically */
        align-items: flex-start;
        gap: 0.25rem;
        width: 100%;
    }
    
    .header-titles h2, .header-titles p {
        display: block; /* Ensure it is visible on mobile so they know what page they are on */
    }
    
    .mobile-top-bar {
        display: flex !important;
        width: 100%;
        align-items: center;
        gap: 0.5rem;
        padding-bottom: 1rem;
        margin-bottom: 1rem;
        border-bottom: 1px solid var(--border-color);
    }
    
    .mobile-logo {
        display: block !important;
    }

    .mobile-brand {
        display: block !important;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-bar {
        width: auto !important;
        flex: 1;
    }
    
    .mobile-logout {
        display: flex !important;
        align-items: center;
        gap: 0.25rem;
    }
}

.mobile-top-bar {
    display: none; /* Hidden on desktop */
}

@media (max-width: 480px) {
    .nav-link span {
        display: none; /* Hide text on very small screens, show only icons */
    }
}
