/**
 * HexVault - Zero-Knowledge Password Manager
 * 
 * Author: Michale McCarthy
 * Copyright (c) 2026 Michale McCarthy. All rights reserved.
 * 
 * Main stylesheet
 */

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

        html {
            height: 100%;
            overflow: hidden;
            position: fixed;
            width: 100%;
        }

        :root {
            --mono: 'DM Mono', monospace;
            --sans: 'DM Sans', sans-serif;
        }

        /* DARK THEME (DEFAULT) */
        [data-theme="dark"] {
            --bg:        #0d0d0f;
            --surface:   #13131a;
            --border:    #1e1e2a;
            --border-hi: #2e2e3e;
            --text:      #e2e2e8;
            --muted:     #6b6b7e;
            --accent:    #5b6af0;
            --accent-hi: #7c8af7;
            --danger:    #e05252;
            --success:   #4ec994;
            --matrix:    rgba(0, 255, 65, 0.1);
            --glow:      rgba(91, 106, 240, 0.08);
        }

        /* LIGHT THEME */
        [data-theme="light"] {
            --bg:        #ffffff;
            --surface:   #f8f9fa;
            --border:    #e1e4e8;
            --border-hi: #d1d5da;
            --text:      #24292e;
            --muted:     #6a737d;
            --accent:    #5b6af0;
            --accent-hi: #4a5ad5;
            --danger:    #d73a49;
            --success:   #28a745;
            --matrix:    rgba(91, 106, 240, 0.05);
            --glow:      rgba(91, 106, 240, 0.03);
        }

        body {
            font-family: var(--sans);
            background: var(--bg);
            color: var(--text);
            min-height: 100vh;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            line-height: 1.6;
            position: relative;
            overflow: hidden;
            transition: background 0.3s ease, color 0.3s ease;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        /* Animated hex pattern background */
        body::before {
            content: '';
            position: fixed;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background-image: 
                repeating-linear-gradient(0deg, transparent, transparent 29px, var(--border) 29px, var(--border) 30px),
                repeating-linear-gradient(60deg, transparent, transparent 29px, var(--border) 29px, var(--border) 30px),
                repeating-linear-gradient(120deg, transparent, transparent 29px, var(--border) 29px, var(--border) 30px);
            opacity: 0.15;
            animation: hexRotate 20s linear infinite;
            pointer-events: none;
            z-index: 0;
        }

        @keyframes hexRotate {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* Hex glow accent */
        body::after {
            content: '';
            position: fixed;
            top: 20%;
            right: 10%;
            width: 400px;
            height: 400px;
            background: radial-gradient(circle, var(--glow) 0%, transparent 70%);
            border-radius: 50%;
            pointer-events: none;
            z-index: 0;
            animation: hexPulse 8s ease-in-out infinite;
        }

        @keyframes hexPulse {
            0%, 100% { opacity: 0.5; transform: scale(1); }
            50% { opacity: 0.8; transform: scale(1.2); }
        }

        /* THEME TOGGLE BUTTON */
        .theme-toggle {
            position: fixed;
            top: 20px;
            right: 20px;
            z-index: 1000;
            width: 44px;
            height: 44px;
            border-radius: 50%;
            border: 1px solid var(--border-hi);
            background: var(--surface);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }

        .theme-toggle:hover {
            background: var(--border);
            transform: scale(1.05);
        }

        .theme-toggle svg {
            color: var(--text);
            transition: all 0.3s ease;
        }

        [data-theme="dark"] .sun-icon { display: none; }
        [data-theme="dark"] .moon-icon { display: block; }
        [data-theme="light"] .sun-icon { display: block; }
        [data-theme="light"] .moon-icon { display: none; }

        /* AUTH CONTAINER - SPLIT SCREEN */
        #authContainer {
            display: flex;
            width: 100%;
            max-width: 1400px;
            height: 90vh;
            max-height: 800px;
            background: var(--surface);
            border-radius: 20px;
            overflow: hidden;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            position: relative;
            z-index: 1;
        }

        #authContainer.hidden { display: none; }

        /* LEFT SIDE - BRANDING & VISUAL */
        .auth-left {
            flex: 1;
            display: flex;
            flex-direction: column;
            padding: 60px;
            background: linear-gradient(135deg, var(--bg) 0%, var(--surface) 100%);
            position: relative;
        }

        .auth-brand {
            margin-bottom: 60px;
        }

        .brand-title {
            font-family: var(--mono);
            font-size: 48px;
            font-weight: 500;
            letter-spacing: -0.02em;
            color: var(--text);
            margin-bottom: 12px;
        }

        .brand-highlight {
            color: var(--accent);
            font-weight: 600;
            position: relative;
            display: inline-block;
        }

        .brand-highlight::after {
            content: '';
            position: absolute;
            bottom: 4px;
            left: 0;
            right: 0;
            height: 2px;
            background: var(--accent);
            opacity: 0.4;
        }

        .brand-subtitle {
            font-size: 16px;
            color: var(--muted);
            font-weight: 300;
            letter-spacing: 0.05em;
            text-transform: uppercase;
        }

        /* SECURITY VISUALIZATION */
        .security-visual {
            flex: 1;
            position: relative;
            border-radius: 12px;
            overflow: hidden;
            background: var(--bg);
            border: 1px solid var(--border);
        }

        #securityCanvas {
            width: 100%;
            height: 100%;
            display: block;
        }

        .visual-overlay {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            padding: 30px;
            background: linear-gradient(to top, var(--surface) 0%, transparent 100%);
        }

        .security-features {
            display: flex;
            gap: 30px;
            justify-content: space-around;
        }

        .feature-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
        }

        .feature-icon {
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--accent);
            filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
        }
        
        .feature-icon svg {
            width: 32px;
            height: 32px;
        }

        .feature-text {
            font-size: 12px;
            color: var(--muted);
            font-weight: 500;
            text-align: center;
        }

        /* DIVIDER LINE */
        .auth-divider {
            width: 1px;
            background: var(--border-hi);
            margin: 40px 0;
        }

        /* RIGHT SIDE - LOGIN FORM */
        .auth-right {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 60px;
        }

        /* AUTH FORM */
        #authForm {
            width: 100%;
            max-width: 400px;
        }

        #authForm.hidden { display: none; }

        .auth-logo {
            font-family: var(--mono);
            font-size: 11px;
            letter-spacing: 0.2em;
            color: var(--muted);
            text-transform: uppercase;
            margin-bottom: 48px;
        }

        .auth-logo span { color: var(--accent); }

        .auth-heading {
            font-size: 22px;
            font-weight: 300;
            letter-spacing: -0.02em;
            margin-bottom: 6px;
        }

        .auth-sub {
            font-size: 13px;
            color: var(--muted);
            margin-bottom: 36px;
        }

        .field {
            display: flex;
            flex-direction: column;
            gap: 6px;
            margin-bottom: 16px;
        }

        .field label {
            font-family: var(--mono);
            font-size: 11px;
            letter-spacing: 0.1em;
            color: var(--muted);
            text-transform: uppercase;
        }

        .field input, .field textarea {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 11px 14px;
            color: var(--text);
            font-family: var(--sans);
            font-size: 14px;
            outline: none;
            transition: border-color 0.15s;
            width: 100%;
        }

        .field input:focus, .field textarea:focus { border-color: var(--accent); }
        .field input::placeholder, .field textarea::placeholder { color: var(--muted); }
        .field textarea { resize: vertical; min-height: 80px; }

        .btn-primary {
            background: var(--accent);
            color: #fff;
            border: none;
            border-radius: 6px;
            padding: 12px 20px;
            font-family: var(--sans);
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            width: 100%;
            margin-top: 8px;
            transition: background 0.15s;
        }

        .btn-primary:hover { background: var(--accent-hi); }

        .auth-toggle {
            margin-top: 24px;
            font-size: 13px;
            color: var(--muted);
            text-align: center;
        }

        .auth-toggle a {
            color: var(--accent-hi);
            cursor: pointer;
        }

        .auth-toggle a:hover { text-decoration: underline; }

        #authAlert { margin-top: 16px; }

        /* VAULT */
        #vaultContainer {
            display: none;
            width: 100%;
            min-height: 100vh;
            position: fixed;
            top: 0;
            left: 0;
            z-index: 10;
            background: var(--bg);
        }

        #vaultContainer.active { display: flex; }

        .sidebar {
            width: 240px;
            min-height: 100vh;
            background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
            border-right: 1px solid var(--border-hi);
            display: flex;
            flex-direction: column;
            padding: 32px 0;
            flex-shrink: 0;
            position: relative;
            box-shadow: 4px 0 16px rgba(0, 0, 0, 0.1);
        }
        
        .sidebar::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 3px;
            height: 100%;
            background: linear-gradient(180deg, var(--accent) 0%, transparent 30%, transparent 70%, var(--accent) 100%);
            opacity: 0.6;
        }

        .sidebar-logo {
            font-family: var(--mono);
            font-size: 11px;
            letter-spacing: 0.2em;
            color: var(--muted);
            text-transform: uppercase;
            padding: 0 20px 32px;
        }

        .sidebar-logo span { color: var(--accent); }

        .sidebar-nav {
            flex: 1;
            padding: 0 12px;
        }

        .nav-item {
            padding: 11px 14px;
            border-radius: 8px;
            font-size: 13px;
            color: var(--muted);
            cursor: pointer;
            font-family: var(--mono);
            letter-spacing: 0.02em;
            transition: all 0.2s ease;
            position: relative;
            margin-bottom: 4px;
        }
        
        .nav-item::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 0;
            height: 60%;
            background: var(--accent);
            border-radius: 0 4px 4px 0;
            transition: width 0.2s ease;
        }
        
        .nav-item:hover {
            color: var(--text);
            background: rgba(91, 106, 240, 0.1);
        }

        .nav-item.active { 
            color: var(--accent); 
            background: rgba(91, 106, 240, 0.15);
        }
        
        .nav-item.active::before {
            width: 3px;
        }

        .sidebar-footer {
            margin: 0 12px;
            padding: 16px 0 0;
            border-top: 1px solid var(--border);
        }

        .user-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 6px 0;
            gap: 8px;
        }

        .user-name {
            font-size: 12px;
            font-family: var(--mono);
            color: var(--muted);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .btn-logout {
            background: none;
            border: 1px solid var(--border);
            border-radius: 4px;
            padding: 4px 10px;
            color: var(--muted);
            font-family: var(--mono);
            font-size: 11px;
            cursor: pointer;
            transition: color 0.15s, border-color 0.15s;
            white-space: nowrap;
            flex-shrink: 0;
        }

        .btn-logout:hover { color: var(--danger); border-color: var(--danger); }

        .btn-reencrypt {
            width: 100%;
            margin-top: 12px;
            background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hi) 100%);
            border: none;
            border-radius: 6px;
            padding: 10px 16px;
            color: white;
            font-family: var(--mono);
            font-size: 12px;
            font-weight: 500;
            cursor: pointer;
            transition: transform 0.15s, box-shadow 0.15s;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        .btn-reencrypt:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(91, 106, 240, 0.3);
        }

        .btn-reencrypt svg {
            animation: spin 2s linear infinite;
        }

        @keyframes spin {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }

        .main { 
            flex: 1; 
            display: flex; 
            flex-direction: column; 
            min-height: 100vh; 
            overflow: hidden; 
            background: linear-gradient(135deg, var(--bg) 0%, var(--surface) 100%);
        }

        .topbar {
            padding: 24px 32px;
            border-bottom: 1px solid var(--border-hi);
            display: flex;
            align-items: center;
            gap: 16px;
            background: var(--surface);
            backdrop-filter: blur(10px);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        }

        .search-wrap { flex: 1; max-width: 400px; }

        .search-wrap input {
            width: 100%;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 9px 14px;
            color: var(--text);
            font-family: var(--sans);
            font-size: 13px;
            outline: none;
            transition: border-color 0.15s;
        }

        .search-wrap input:focus { border-color: var(--border-hi); }
        .search-wrap input::placeholder { color: var(--muted); }

        .btn-add {
            background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hi) 100%);
            color: #fff;
            border: none;
            border-radius: 8px;
            padding: 10px 20px;
            font-family: var(--mono);
            font-size: 12px;
            letter-spacing: 0.05em;
            cursor: pointer;
            transition: all 0.2s ease;
            white-space: nowrap;
            box-shadow: 0 2px 8px rgba(91, 106, 240, 0.3);
        }

        .btn-add:hover { 
            transform: translateY(-2px);
            box-shadow: 0 4px 16px rgba(91, 106, 240, 0.4);
        }

        .content { 
            flex: 1; 
            padding: 32px 36px; 
            overflow-y: auto;
            background: linear-gradient(180deg, transparent 0%, var(--bg) 10%);
        }

        #passwordList { 
            display: flex; 
            flex-direction: column; 
            gap: 8px; 
        }

        .entry {
            display: flex;
            align-items: center;
            padding: 16px 20px;
            border-radius: 10px;
            background: var(--surface);
            border: 1px solid var(--border);
            cursor: pointer;
            transition: all 0.2s ease;
            gap: 16px;
            position: relative;
            overflow: hidden;
        }
        
        .entry::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 3px;
            background: var(--accent);
            opacity: 0;
            transition: opacity 0.2s ease;
        }

        .entry:hover { 
            border-color: var(--border-hi); 
            background: var(--bg);
            transform: translateX(4px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        }
        
        .entry:hover::before {
            opacity: 1;
        }

        .entry-icon {
            width: 34px;
            height: 34px;
            border-radius: 6px;
            background: var(--border);
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: var(--mono);
            font-size: 13px;
            color: var(--accent-hi);
            flex-shrink: 0;
            text-transform: uppercase;
            font-weight: 500;
        }

        .entry-info { flex: 1; min-width: 0; }

        .entry-name {
            font-size: 14px;
            font-weight: 500;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .entry-user {
            font-size: 12px;
            color: var(--muted);
            font-family: var(--mono);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .entry-actions {
            display: flex;
            gap: 6px;
            opacity: 0;
            transition: opacity 0.15s;
        }

        .entry:hover .entry-actions { opacity: 1; }

        .btn-icon {
            background: var(--border);
            border: none;
            border-radius: 4px;
            padding: 6px 10px;
            color: var(--muted);
            font-family: var(--mono);
            font-size: 11px;
            cursor: pointer;
            transition: color 0.15s, background 0.15s;
        }

        .btn-icon:hover { color: var(--text); background: var(--border-hi); }

        .empty-state {
            text-align: center;
            padding: 80px 20px;
            color: var(--muted);
            font-family: var(--mono);
            font-size: 13px;
        }

        /* MODALS */
        .modal-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.7);
            z-index: 100;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .modal-overlay.active { display: flex; }

        .modal {
            background: var(--surface);
            border: 1px solid var(--border-hi);
            border-radius: 10px;
            padding: 28px;
            width: 100%;
            max-width: 460px;
            max-height: 90vh;
            overflow-y: auto;
        }

        .modal-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 24px;
        }

        .modal-title {
            font-family: var(--mono);
            font-size: 11px;
            letter-spacing: 0.12em;
            color: var(--muted);
            text-transform: uppercase;
        }

        .btn-close {
            background: none;
            border: 1px solid var(--border);
            color: var(--muted);
            font-size: 14px;
            cursor: pointer;
            padding: 3px 8px;
            border-radius: 4px;
            transition: color 0.15s, border-color 0.15s;
            line-height: 1.4;
            font-family: var(--mono);
        }

        .btn-close:hover { color: var(--text); border-color: var(--border-hi); }

        .form-grid { display: flex; flex-direction: column; gap: 16px; }
        .form-grid .field { margin-bottom: 0; }

        input[type=hidden] { display: none !important; }

        .modal-footer {
            display: flex;
            gap: 10px;
            margin-top: 24px;
            justify-content: flex-end;
        }

        .btn-secondary {
            background: none;
            border: 1px solid var(--border-hi);
            border-radius: 6px;
            padding: 10px 18px;
            color: var(--muted);
            font-family: var(--sans);
            font-size: 13px;
            cursor: pointer;
            transition: color 0.15s, border-color 0.15s;
        }

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

        .btn-save {
            background: var(--accent);
            border: none;
            border-radius: 6px;
            padding: 10px 22px;
            color: #fff;
            font-family: var(--sans);
            font-size: 13px;
            font-weight: 500;
            cursor: pointer;
            transition: background 0.15s;
        }

        .btn-save:hover { background: var(--accent-hi); }

        /* Generator */
        .generator-box {
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 16px;
        }

        .generator-label {
            font-family: var(--mono);
            font-size: 10px;
            letter-spacing: 0.12em;
            color: var(--muted);
            text-transform: uppercase;
            margin-bottom: 12px;
        }

        .generated-output {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 5px;
            padding: 10px 12px;
            font-family: var(--mono);
            font-size: 13px;
            color: var(--accent-hi);
            margin-bottom: 12px;
            min-height: 38px;
            word-break: break-all;
            letter-spacing: 0.02em;
        }

        .gen-row {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 8px;
        }

        .gen-row label { font-size: 12px; color: var(--muted); flex: 1; }

        .gen-row input[type=range] { flex: 2; accent-color: var(--accent); }

        .gen-length-val {
            font-family: var(--mono);
            font-size: 12px;
            color: var(--text);
            width: 24px;
            text-align: right;
        }

        .gen-checkboxes {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 6px;
            margin-bottom: 12px;
        }

        .gen-check {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 12px;
            color: var(--muted);
            cursor: pointer;
        }

        .gen-check input[type=checkbox] { accent-color: var(--accent); cursor: pointer; }

        .gen-actions { display: flex; gap: 8px; }

        .btn-gen {
            background: var(--border);
            border: none;
            border-radius: 5px;
            padding: 7px 14px;
            color: var(--muted);
            font-family: var(--mono);
            font-size: 11px;
            cursor: pointer;
            transition: color 0.15s, background 0.15s;
        }

        .btn-gen:hover { color: var(--text); background: var(--border-hi); }
        .btn-gen.accent { background: var(--accent); color: #fff; }
        .btn-gen.accent:hover { background: var(--accent-hi); }

        /* View modal */
        .view-modal { max-width: 420px; }

        .view-row {
            padding: 12px 0;
            border-bottom: 1px solid var(--border);
        }

        .view-row:last-child { border-bottom: none; }

        .view-row-label {
            font-family: var(--mono);
            font-size: 10px;
            letter-spacing: 0.1em;
            color: var(--muted);
            text-transform: uppercase;
            margin-bottom: 4px;
        }

        .view-row-value {
            font-family: var(--mono);
            font-size: 13px;
            color: var(--text);
            word-break: break-all;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        #passwordDisplay { flex: 1; letter-spacing: 0.04em; }

        .btn-toggle-vis {
            background: none;
            border: 1px solid var(--border);
            border-radius: 4px;
            padding: 3px 8px;
            color: var(--muted);
            font-family: var(--mono);
            font-size: 10px;
            cursor: pointer;
            transition: color 0.15s;
            white-space: nowrap;
        }

        .btn-toggle-vis:hover { color: var(--text); }

        .view-actions {
            display: flex;
            gap: 8px;
            margin-top: 24px;
            flex-wrap: wrap;
        }

        .btn-action {
            background: var(--border);
            border: none;
            border-radius: 5px;
            padding: 8px 14px;
            color: var(--muted);
            font-family: var(--mono);
            font-size: 11px;
            cursor: pointer;
            transition: color 0.15s, background 0.15s;
        }

        .btn-action:hover { color: var(--text); background: var(--border-hi); }

        .btn-action.destructive:hover {
            color: var(--danger);
            background: rgba(224,82,82,0.08);
        }

        /* Alerts */
        .alert {
            padding: 10px 14px;
            border-radius: 5px;
            font-family: var(--mono);
            font-size: 12px;
        }

        .alert-error {
            background: rgba(224,82,82,0.08);
            border: 1px solid rgba(224,82,82,0.25);
            color: var(--danger);
        }

        .alert-success {
            background: rgba(78,201,148,0.08);
            border: 1px solid rgba(78,201,148,0.25);
            color: var(--success);
        }

        .alert-info {
            background: rgba(91,106,240,0.08);
            border: 1px solid rgba(91,106,240,0.25);
            color: var(--accent-hi);
        }

        ::-webkit-scrollbar { width: 4px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 2px; }

        .view-link {
            color: var(--accent-hi);
            text-decoration: none;
        }

        .view-link:hover { text-decoration: underline; }

        .view-notes {
            white-space: pre-wrap;
            font-family: var(--sans);
            font-size: 13px;
        }

/* Classes to replace inline styles */
.view-link {
    color: var(--accent-hi);
    text-decoration: none;
}
.view-link:hover { text-decoration: underline; }

.view-notes {
    white-space: pre-wrap;
    font-family: var(--sans);
    font-size: 13px;
}


.strength-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.strength-track {
    flex: 1;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: width 0.3s ease, background 0.3s ease;
}

.strength-label {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    min-width: 64px;
    text-align: right;
    transition: color 0.3s;
}


.entry-favicon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 3px;
}

.entry-icon-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-family: var(--mono);
    font-size: 13px;
    color: var(--accent-hi);
    font-weight: 500;
    text-transform: uppercase;
}


#toastContainer {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    background: var(--surface);
    border: 1px solid var(--border-hi);
    border-radius: 6px;
    padding: 10px 16px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    max-width: 320px;
}

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

        /* RESPONSIVE DESIGN */
        @media (max-width: 1024px) {
            #authContainer {
                flex-direction: column;
                height: auto;
                max-height: none;
            }
            
            .auth-left {
                padding: 40px;
            }
            
            .brand-title {
                font-size: 36px;
            }
            
            .security-visual {
                min-height: 300px;
            }
            
            .auth-divider {
                width: 100%;
                height: 1px;
                margin: 0;
            }
            
            .auth-right {
                padding: 40px;
            }
        }
        
        @media (max-width: 640px) {
            #authContainer {
                border-radius: 0;
                height: 100vh;
                max-height: 100vh;
            }
            
            .theme-toggle {
                top: 10px;
                right: 10px;
                width: 40px;
                height: 40px;
            }
            
            .auth-left {
                padding: 30px 20px;
            }
            
            .brand-title {
                font-size: 28px;
            }
            
            .brand-subtitle {
                font-size: 12px;
            }
            
            .security-features {
                gap: 15px;
            }
            
            .feature-icon {
                font-size: 24px;
            }
            
            .feature-text {
                font-size: 10px;
            }
            
            .auth-right {
                padding: 30px 20px;
            }
        }

        /* STATS DASHBOARD */
        .stats-dashboard {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 16px;
            padding: 24px 36px;
            background: var(--surface);
            border-bottom: 1px solid var(--border);
        }
        
        .stat-card {
            display: flex;
            align-items: center;
            gap: 16px;
            padding: 20px;
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 12px;
            transition: all 0.3s ease;
            cursor: pointer;
            position: relative;
            overflow: hidden;
        }
        
        .stat-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 3px;
            background: var(--accent);
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        
        .stat-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
            border-color: var(--accent);
        }
        
        .stat-card:hover::before {
            opacity: 1;
        }
        
        .stat-card.stat-strong::before {
            background: var(--success);
        }
        
        .stat-card.stat-weak::before {
            background: var(--danger);
        }
        
        .stat-card.stat-recent::before {
            background: var(--accent-hi);
        }
        
        .stat-icon {
            width: 48px;
            height: 48px;
            border-radius: 10px;
            background: rgba(91, 106, 240, 0.1);
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--accent);
            flex-shrink: 0;
        }
        
        .stat-strong .stat-icon {
            background: rgba(78, 201, 148, 0.1);
            color: var(--success);
        }
        
        .stat-weak .stat-icon {
            background: rgba(224, 82, 82, 0.1);
            color: var(--danger);
        }
        
        .stat-recent .stat-icon {
            background: rgba(124, 138, 247, 0.1);
            color: var(--accent-hi);
        }
        
        .stat-content {
            flex: 1;
        }
        
        .stat-value {
            font-size: 28px;
            font-weight: 500;
            font-family: var(--mono);
            color: var(--text);
            line-height: 1;
            margin-bottom: 4px;
        }
        
        .stat-label {
            font-size: 12px;
            color: var(--muted);
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }
        
        /* EMPTY STATE */
        .empty-state {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 80px 20px;
            text-align: center;
        }
        
        .empty-icon {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            background: var(--surface);
            border: 2px dashed var(--border);
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--muted);
            margin-bottom: 24px;
            animation: pulse 3s ease-in-out infinite;
        }
        
        @keyframes pulse {
            0%, 100% { opacity: 0.6; transform: scale(1); }
            50% { opacity: 1; transform: scale(1.05); }
        }
        
        .empty-state h3 {
            font-size: 20px;
            color: var(--text);
            margin-bottom: 8px;
        }
        
        .empty-state p {
            font-size: 14px;
            color: var(--muted);
        }
        
        /* ENHANCED PASSWORD ENTRIES WITH QUICK ACTIONS */
        .entry-actions {
            display: flex;
            gap: 8px;
            opacity: 0;
            transform: translateX(-10px);
            transition: all 0.2s ease;
        }
        
        .entry:hover .entry-actions {
            opacity: 1;
            transform: translateX(0);
        }
        
        .quick-action {
            width: 32px;
            height: 32px;
            border-radius: 6px;
            background: var(--surface);
            border: 1px solid var(--border);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s ease;
            color: var(--muted);
        }
        
        .quick-action:hover {
            background: var(--accent);
            border-color: var(--accent);
            color: white;
            transform: scale(1.1);
        }
        
        .quick-action svg {
            width: 16px;
            height: 16px;
        }
        
        /* SEARCH HIGHLIGHT */
        .search-highlight {
            background: rgba(91, 106, 240, 0.3);
            padding: 2px 4px;
            border-radius: 3px;
            font-weight: 500;
        }
        
        /* LOADING ANIMATION FOR NEW ENTRIES */
        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateY(-20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .entry.new-entry {
            animation: slideIn 0.3s ease-out;
        }
        
        /* PASSWORD STRENGTH INDICATOR */
        .strength-indicator {
            display: flex;
            gap: 4px;
            margin-top: 8px;
        }
        
        .strength-bar {
            height: 3px;
            flex: 1;
            background: var(--border);
            border-radius: 2px;
            transition: background 0.3s ease;
        }
        
        .strength-bar.active {
            background: var(--danger);
        }
        
        .strength-bar.active.medium {
            background: #ffa500;
        }
        
        .strength-bar.active.strong {
            background: var(--success);
        }

        /* MOBILE FIXES FOR VAULT */
        @media (max-width: 768px) {
            /* Fix body overflow */
            body {
                overflow-x: hidden;
            }
            
            /* Make vault container scrollable */
            #vaultContainer {
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
                height: 100vh;
                position: fixed;
                top: 0;
                left: 0;
                right: 0;
                bottom: 0;
            }
            
            /* Stack sidebar and main vertically */
            #vaultContainer.active {
                flex-direction: column;
            }
            
            /* Compact sidebar */
            .sidebar {
                width: 100%;
                min-height: auto;
                padding: 16px 0;
                border-right: none;
                border-bottom: 1px solid var(--border-hi);
                box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            }
            
            .sidebar::before {
                display: none;
            }
            
            .sidebar-logo {
                padding: 0 20px;
                font-size: 16px;
                margin-bottom: 12px;
            }
            
            .sidebar-nav {
                padding: 0 20px;
                display: flex;
                gap: 8px;
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
            }
            
            .nav-item {
                white-space: nowrap;
                padding: 8px 16px;
                font-size: 12px;
            }
            
            .sidebar-footer {
                margin: 12px 20px 0;
                padding-top: 12px;
            }
            
            .user-name {
                font-size: 11px;
            }
            
            .btn-logout {
                font-size: 10px;
                padding: 4px 8px;
            }
            
            /* Main content area */
            .main {
                flex: 1;
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
                min-height: calc(100vh - 200px);
            }
            
            /* Topbar */
            .topbar {
                padding: 16px 20px;
                flex-wrap: wrap;
                gap: 12px;
            }
            
            .search-wrap {
                flex: 1;
                min-width: 100%;
                order: 2;
            }
            
            .btn-add {
                order: 1;
                font-size: 11px;
                padding: 8px 16px;
            }
            
            /* Stats dashboard */
            .stats-dashboard {
                grid-template-columns: 1fr 1fr;
                gap: 12px;
                padding: 16px 20px;
            }
            
            .stat-card {
                padding: 16px;
                gap: 12px;
            }
            
            .stat-icon {
                width: 40px;
                height: 40px;
            }
            
            .stat-icon svg {
                width: 20px;
                height: 20px;
            }
            
            .stat-value {
                font-size: 22px;
            }
            
            .stat-label {
                font-size: 10px;
            }
            
            /* Content area */
            .content {
                padding: 20px;
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
            }
            
            /* Password entries */
            .entry {
                padding: 14px 16px;
                gap: 12px;
            }
            
            .entry:hover {
                transform: none;
            }
            
            .entry-icon {
                width: 32px;
                height: 32px;
            }
            
            .entry-info {
                flex: 1;
                min-width: 0;
            }
            
            .entry-name {
                font-size: 14px;
            }
            
            .entry-username {
                font-size: 11px;
            }
            
            /* Quick actions always visible on mobile */
            .entry-actions {
                opacity: 1;
                transform: translateX(0);
                flex-direction: column;
                gap: 4px;
            }
            
            .quick-action {
                width: 28px;
                height: 28px;
            }
            
            /* Modals */
            .modal {
                width: 95%;
                max-width: 400px;
                margin: 20px;
                max-height: 90vh;
                overflow-y: auto;
            }
            
            .modal-header {
                padding: 16px 20px;
            }
            
            .modal-body {
                padding: 20px;
            }
            
            /* Empty state */
            .empty-state {
                padding: 60px 20px;
            }
            
            .empty-icon {
                width: 60px;
                height: 60px;
            }
            
            .empty-state h3 {
                font-size: 18px;
            }
            
            /* Theme toggle */
            .theme-toggle {
                top: 16px;
                right: 16px;
                z-index: 1001;
            }
            
            /* Auth container on mobile */
            #authContainer {
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
            }
        }
        
        /* Very small screens */
        @media (max-width: 400px) {
            .stats-dashboard {
                grid-template-columns: 1fr;
            }
            
            .stat-card {
                padding: 12px;
            }
            
            .entry-actions {
                display: none;
            }
            
            .topbar {
                padding: 12px 16px;
            }
            
            .content {
                padding: 16px;
            }
        }

/*  BREACH WARNING STYLES  */

.breach-warning {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: rgba(255, 107, 107, 0.15);
    color: #ff6b6b;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.entry[data-breached="true"] {
    border-left: 3px solid #ff6b6b;
    background: rgba(255, 107, 107, 0.03);
}

.entry[data-breached="true"]:hover {
    background: rgba(255, 107, 107, 0.08);
}

#breachedPasswords {
    color: #ff6b6b;
}

.stat-card:has(#breachedPasswords) .stat-icon {
    color: #ff6b6b;
}

.stat-card:has(#breachedPasswords) {
    border-left: 3px solid #ff6b6b;
}

/* ==========================================
   ENHANCED MOBILE RESPONSIVENESS
   ========================================== */

/* Small mobile phones (320px - 480px) */
@media (max-width: 480px) {
    /* Make everything more touch-friendly */
    .btn-primary, .btn-secondary, .btn-save, .btn-delete {
        min-height: 48px;
        font-size: 16px;
        padding: 12px 20px;
    }
    
    /* Larger input fields for easier typing */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea {
        font-size: 16px;
        min-height: 48px;
        padding: 12px 16px;
    }
    
    /* Prevent zoom on input focus */
    input:focus, textarea:focus, select:focus {
        font-size: 16px;
    }
    
    /* Make modals full screen on mobile */
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 95vh;
        margin: 0;
        border-radius: 12px;
    }
    
    /* Responsive table for password list */
    .password-item {
        padding: 16px;
        flex-direction: column;
        gap: 12px;
    }
    
    .password-details {
        width: 100%;
    }
    
    .password-actions {
        width: 100%;
        justify-content: flex-end;
        gap: 8px;
    }
    
    /* Stack form fields vertically */
    .form-row {
        flex-direction: column;
    }
    
    .form-group {
        width: 100%;
    }
    
    /* Make stats cards stack */
    .stats-container {
        flex-direction: column;
    }
    
    .stat-card {
        width: 100%;
    }
    
    /* Improve navigation on mobile */
    .nav-item {
        padding: 14px 20px;
        font-size: 15px;
    }
    
    /* Better spacing for mobile */
    .container {
        padding: 16px;
    }
    
    /* Adjust header for mobile */
    .header {
        padding: 12px 16px;
    }
    
    .header-title {
        font-size: 18px;
    }
    
    /* Make search bar more prominent */
    .search-wrapper {
        width: 100%;
        margin: 12px 0;
    }
    
    #passwordSearch {
        font-size: 16px;
        padding: 12px 16px 12px 40px;
    }
    
    /* Improve QR code display */
    .qr-code {
        width: 200px;
        height: 200px;
        margin: 16px auto;
    }
    
    /* Better backup codes layout */
    .backup-codes-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    /* Adjust toast notifications */
    .toast {
        bottom: 20px;
        left: 10px;
        right: 10px;
        width: auto;
        max-width: calc(100% - 20px);
    }
}

/* Tablet portrait (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .password-item {
        padding: 16px;
    }
    
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .modal-content {
        max-width: 90%;
    }
    
    .container {
        padding: 20px;
    }
}

/* Landscape phone optimization */
@media (max-height: 500px) and (orientation: landscape) {
    #authContainer {
        height: auto;
        min-height: 100vh;
    }
    
    .auth-left {
        min-height: auto;
        padding: 20px;
    }
    
    .security-visual {
        min-height: 200px;
        display: none; /* Hide canvas on landscape to save space */
    }
    
    .auth-right {
        padding: 30px 20px;
    }
    
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Sharper borders and shadows */
    .btn-primary, .btn-secondary {
        border-width: 0.5px;
    }
    
    .password-item {
        border-width: 0.5px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    button, a, .nav-item {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover states that don't work on touch */
    .btn-primary:hover,
    .btn-secondary:hover,
    .nav-item:hover {
        transform: none;
    }
    
    /* Add active/tap states instead */
    .btn-primary:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    
    .nav-item:active {
        background: var(--border-hi);
    }
    
    /* Larger tap areas for icons */
    .password-actions button {
        min-width: 44px;
        min-height: 44px;
        padding: 10px;
    }
}

/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .header {
        padding-top: max(12px, env(safe-area-inset-top));
    }
}

/* Improve readability on small screens */
@media (max-width: 380px) {
    body {
        font-size: 14px;
    }
    
    .brand-title {
        font-size: 24px;
    }
    
    .auth-heading {
        font-size: 22px;
    }
    
    .modal-title {
        font-size: 18px;
    }
    
    /* Smaller spacing */
    .container {
        padding: 12px;
    }
    
    .password-item {
        padding: 12px;
    }
}

