:root {
    /* Color Palette */
    --bg-dark: #07090E;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: rgba(255, 255, 255, 0.1);
    --secondary-hover: rgba(255, 255, 255, 0.15);
    
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    
    --glow-1: #8b5cf6;
    --glow-2: #3b82f6;
    --glow-3: #10b981;
    
    /* Variables */
    --radius: 16px;
    --radius-sm: 8px;
    --transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    position: fixed; /* Strictly prevents mobile browser vertical bounce gap */
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Dynamic Ambient Background */
.glow-orb {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.5;
    animation: float 20s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}

.orb-1 {
    top: -200px;
    left: -100px;
    background: radial-gradient(circle, var(--glow-1) 0%, transparent 70%);
}
.orb-2 {
    bottom: -200px;
    right: -100px;
    background: radial-gradient(circle, var(--glow-2) 0%, transparent 70%);
    animation-delay: -5s;
}
.orb-3 {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--glow-3) 0%, transparent 70%);
    animation-delay: -10s;
    opacity: 0.3;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, -50px) scale(1.1); }
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}

/* Layout */
.app-container {
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    max-height: 900px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

/* Views */
.view {
    width: 100%;
    max-width: 480px;
    transition: opacity 0.5s ease, transform 0.5s ease;
    opacity: 1;
    transform: translateY(0);
    position: absolute;
}
.view.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}
.view.active {
    z-index: 10;
}
.view.full-height {
    max-width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Typography elements */
.text-center { text-align: center; }
.gradient-text {
    background: linear-gradient(135deg, #fff, #a5b4fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 2.5rem;
    font-weight: 700;
    margin: 1rem 0 0.5rem;
}
.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 300;
    margin-bottom: 2rem;
}
h2 { font-weight: 600; font-size: 1.8rem; margin-bottom: 0.5rem; }
h3 { font-weight: 500; font-size: 1.4rem; }
.logo { margin-bottom: 1rem; color: var(--primary); }
.logo.small { margin-bottom: 0.5rem; }
.logo.tiny svg { opacity: 0.8; transition: var(--transition); }
.logo.tiny:hover svg { opacity: 1; transform: scale(1.1); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
}
.btn.primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}
.btn.primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}
.btn.secondary {
    background: var(--secondary);
    color: #fff;
    border: 1px solid var(--glass-border);
}
.btn.secondary:hover {
    background: var(--secondary-hover);
    transform: translateY(-2px);
}
.btn.text-btn {
    background: transparent;
    color: var(--text-secondary);
}
.btn.text-btn:hover {
    color: var(--text-primary);
}
.btn.error-btn.outline {
    background: transparent;
    color: var(--error);
    border: 1px solid var(--error);
}
.btn.error-btn.outline:hover {
    background: var(--error-bg);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.action-buttons.horizontal {
    flex-direction: row;
    justify-content: center;
}
.full-width { width: 100%; }
.mt-4 { margin-top: 1.5rem; }

/* Forms & Inputs */
.input-group {
    text-align: left;
    margin-bottom: 1.25rem;
}
.input-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 400;
}
.req { color: var(--error); }

input[type="text"], input[type="password"], input[type="url"] {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}
input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.4);
}
.error-msg {
    color: var(--error);
    background: var(--error-bg);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-top: 1rem;
}
.hidden { display: none !important; }

/* Dashboard Styling */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}
.header-left, .header-right { display: flex; align-items: center; gap: 1rem; }
.header-left h2 { margin: 0; font-size: 1.25rem; }
.search-bar input {
    width: 300px;
    padding: 0.6rem 1rem;
    border-radius: 20px;
}

.dashboard-content {
    flex: 1;
    overflow-y: auto;
    border-radius: var(--radius);
    position: relative;
    padding-right: 0.5rem; /* for scrollbar */
}
/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--secondary); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

.empty-state {
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.entries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
    align-content: start;
}

/* Entry Card */
.entry-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.entry-card:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    border-color: rgba(255,255,255,0.15);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-title { font-weight: 600; font-size: 1.1rem; }
.card-actions { display: flex; gap: 0.5rem; opacity: 0; transition: var(--transition); }
.entry-card:hover .card-actions { opacity: 1; }
.card-detail {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-detail-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px;}
.pill {
    background: rgba(0,0,0,0.3);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: monospace;
}
.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    padding: 4px;
    border-radius: 4px;
    display: inline-flex;
}
.icon-btn:hover { color: var(--primary); background: rgba(255,255,255,0.1); }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}
.modal-content {
    width: 100%;
    max-width: 440px;
    padding: 2rem;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.close-btn {
    background: none; border: none; color: var(--text-secondary);
    font-size: 1.8rem; cursor: pointer; transition: color 0.2s;
}
.close-btn:hover { color: #fff; }

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.2);
}
.password-input-wrapper input {
    border: none;
    background: transparent;
    flex: 1;
}
.password-input-wrapper input:focus {
    box-shadow: none;
}
.password-input-wrapper:focus-within {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.4);
}
.password-input-wrapper .icon-btn {
    margin: 0 0.5rem;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
}
.toast {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: max(8px, var(--radius-sm));
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: toastSlide 0.3s ease forwards;
    opacity: 0;
    transform: translateX(100%);
}
@keyframes toastSlide {
    to { opacity: 1; transform: translateX(0); }
}
.toast-leave {
    animation: toastFade 0.3s ease forwards;
}
@keyframes toastFade {
    to { opacity: 0; transform: translateY(10px); }
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
        height: 100%;
        max-height: 100dvh;
        width: 100%;
    }
    .dashboard-content {
        padding-bottom: 5rem; /* Room for fixed copyright footer to avoid overlap */
    }
    .glass-panel { padding: 1.5rem; }
    .dashboard-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1rem;
    }
    .header-left, .header-right { 
        justify-content: space-between; 
        gap: 0.5rem; 
        width: 100%;
    }
    .search-bar { width: 100%; }
    .search-bar input { width: 100%; }
    .entries-grid { grid-template-columns: 1fr; }
    .action-buttons.horizontal { flex-direction: column; }
    .gradient-text { font-size: 2rem; }
}

/* --- Light Mode Theme Definitions --- */
[data-theme="light"] {
    --bg-dark: #f1f5f9;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(0, 0, 0, 0.08);
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: rgba(0, 0, 0, 0.08);
    --secondary-hover: rgba(0, 0, 0, 0.12);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --error: #dc2626;
    --error-bg: rgba(220, 38, 38, 0.15);
}
[data-theme="light"] input[type="text"], 
[data-theme="light"] input[type="password"], 
[data-theme="light"] input[type="url"] {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0,0,0,0.15);
    color: #0f172a;
}
[data-theme="light"] input:focus {
    background: #ffffff;
}
[data-theme="light"] .password-input-wrapper {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0,0,0,0.15);
}
[data-theme="light"] .password-input-wrapper:focus-within {
    background: #ffffff;
}
[data-theme="light"] .gradient-text {
    background: linear-gradient(135deg, #1e293b, #4f46e5);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
[data-theme="light"] .close-btn { color: #0f172a; }
[data-theme="light"] .btn.secondary { color: #0f172a; border-color: rgba(0,0,0,0.1); }
[data-theme="light"] .pill { background: rgba(0,0,0,0.08); color: #0f172a; }
[data-theme="light"] .toast { color: #0f172a; }
