:root {
    --bg-color: #0d0f14;
    --sidebar-bg: #14171d;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --card-bg: #1e293b;
    --danger: #ef4444;
    --success: #10b981;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

h1, h2, h3, .logo span {
    font-family: 'Outfit', sans-serif;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
}

/* Screens */
.screen {
    display: none !important;
    height: 100vh;
}

.screen.active {
    display: flex !important;
}

/* Auth Screen */
#auth-screen {
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at top right, #1e293b, #0d0f14);
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.btn {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.hidden {
    display: none !important;
}

/* Main Screen Layout */
#main-screen {
    display: flex;
}

/* Sidebar */
.sidebar {
    width: 260px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    border-right: 1px solid var(--glass-border);
}

.sidebar-header {
    margin-bottom: 2.5rem;
}

.sidebar-header .logo span {
    font-size: 1.25rem;
    font-weight: 700;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 0.75rem;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
}

.sidebar-nav li:hover {
    background: var(--glass-bg);
    color: var(--text-primary);
}

.sidebar-nav li.active {
    background: rgba(59, 130, 146, 0.15);
    color: var(--primary-color);
    font-weight: 600;
}

/* Glass Buttons & Mini Actions (PRO REFINED) */
.glass-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: scale(1.1);
}

.glass-btn.mini {
    width: 26px;
    height: 26px;
    font-size: 0.8rem;
    border-radius: 50%; /* Circle for pro look */
}

.share-trigger:hover {
    color: var(--primary-color) !important;
    background: rgba(59, 130, 246, 0.15) !important;
    border-color: rgba(59, 130, 246, 0.3) !important;
}

.danger-hover:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #f87171 !important;
}

.group-actions {
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
    display: flex;
    gap: 0.4rem;
}

.sidebar-nav li:hover .group-actions {
    opacity: 1;
    transform: translateX(0);
}

.badge {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    padding: 1px 6px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.nav-divider {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-top: 1.5rem !important;
    padding-bottom: 0.5rem !important;
    cursor: default !important;
    pointer-events: none;
}

.add-group-item {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
}

.add-group-item input {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    background: rgba(0,0,0,0.2);
}

.add-group-item button:hover {
    background: var(--primary-hover);
}

.back-to-vault {
    margin-top: 1rem;
    color: var(--primary-color) !important;
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-info img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.user-info span {
    font-size: 0.9rem;
    font-weight: 500;
}

#logout-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.6;
    transition: var(--transition);
}

#logout-btn:hover {
    opacity: 1;
}

.fav-btn.active {
    color: #fbbf24 !important;
    background: rgba(251, 191, 36, 0.1) !important;
}

/* Settings Page */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 2rem;
}

.settings-card {
    padding: 2rem;
    border-radius: 1.5rem;
}

.settings-card h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.progress-container {
    margin-top: 1.5rem;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 100%;
    width: 0;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

#re-encrypt-status {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.mfa-secret {
    background: rgba(0,0,0,0.3);
    padding: 1rem;
    border-radius: 0.5rem;
    font-family: monospace;
    font-size: 1.2rem;
    text-align: center;
    letter-spacing: 2px;
    margin: 1rem 0;
    color: var(--primary-color);
    border: 1px dashed var(--primary-color);
}

/* Content Area */
.groups-list {
    flex: 1;
    overflow-y: auto;
    margin-top: 1rem;
    padding-right: 0.25rem;
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.search-bar {
    width: 100%;
    max-width: 500px;
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
}

.search-icon {
    margin-right: 0.75rem;
    opacity: 0.5;
}

.search-bar input {
    background: none;
    border: none;
    padding: 0.25rem 0;
}

.search-bar input:focus {
    box-shadow: none;
}

#add-new-btn {
    width: auto;
    padding: 0.75rem 1.5rem;
}

.vault-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.vault-info h2 {
    font-size: 1.5rem;
}

#record-count {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

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

.sidebar {
    width: 280px;
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    flex-shrink: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

.record-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.record-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    border-color: var(--primary-color);
}

.record-logo {
    width: 40px;
    height: 40px;
    background: var(--glass-bg);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.record-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.record-title h4 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.record-title p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.record-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 5px;
}

.action-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
    color: var(--text-color);
}

.action-btn.link-btn {
    text-decoration: none;
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    border-radius: 1.5rem;
}

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

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.password-input-wrapper {
    position: relative;
    display: flex;
    gap: 0.5rem;
}

#generate-password {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 0 0.75rem;
    border-radius: 0.75rem;
    cursor: pointer;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-primary);
}

/* Notifications */
.notification {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem 2rem;
    border-radius: 1rem;
    min-width: 300px;
    text-align: center;
    background: var(--primary-color);
    color: white;
    font-weight: 500;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    animation: slideDown 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

@keyframes slideDown {
    from { transform: translate(-50%, -100%); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

/* View Modal Details */
.view-details {
    padding: 1.25rem 0;
}

.view-group {
    margin-bottom: 1.25rem;
}

.view-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.view-val {
    background: rgba(255, 255, 255, 0.03);
    padding: 0.75rem;
    border-radius: 0.75rem;
    font-size: 1rem;
    color: var(--text-color);
    border: 1px solid var(--glass-border);
    word-break: break-all;
    min-height: 1.2em;
}

.view-val-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.view-val-row .view-val {
    flex: 1;
}

.password-font {
    font-family: 'Monaco', 'Consolas', monospace;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 1.5px;
    background: rgba(79, 70, 229, 0.1);
}

/* Splash Screen */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    z-index: 9999;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#splash-screen.active {
    display: flex;
}

.splash-container {
    text-align: center;
}

.splash-container p {
    margin-top: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.logo-spinner {
    position: relative;
    animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.spinner-dot {
    animation: spin-inner 1.5s infinite linear;
    transform-origin: center;
}

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

/* Mobile Optimization: Mobile Header */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    padding: 0 1.25rem;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.03); /* Back to transparent glass */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    backdrop-filter: blur(4px);
}

/* Responsive Queries */
@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }

    .header-brand {
        display: none !important; /* Hide redundant logo on mobile */
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100%;
        z-index: 999;
        width: 280px;
        transition: var(--transition);
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        padding: 90px 1.25rem 2rem; /* Increased for breathing room */
    }

    .record-actions {
        display: flex;
        gap: 0.4rem;
        flex-wrap: wrap; /* Allow grouping on mobile if needed */
        justify-content: flex-start;
    }

    .action-btn {
        width: 40px; /* Slightly larger for touch */
        height: 40px;
        flex-shrink: 0;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
        margin-bottom: 2rem;
    }

    .header-actions {
        width: 100%;
        flex-direction: column-reverse;
    }

    .search-bar {
        width: 100% !important;
    }

    .vault-grid {
        grid-template-columns: 1fr; /* Single column on mobile */
        gap: 1rem;
    }

    .record-card {
        padding: 1.25rem;
    }

    .auth-container {
        width: 95%;
        padding: 1.5rem;
    }

    .modal {
        width: 95%;
        margin: 1rem;
        padding: 1.25rem;
        max-height: 90vh;
        overflow-y: auto;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .notification {
        top: 1rem;
        left: 1rem;
        right: 1rem;
        width: calc(100% - 2rem);
        transform: none;
    }

    @keyframes slideDown {
        from { transform: translateY(-100%); opacity: 0; }
        to { transform: translateY(0); opacity: 1; }
    }
}

/* Professional Features Styling */
.settings-divider {
    margin: 2rem 0;
    border-top: 1px solid var(--glass-border);
}

.backup-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.activity-card {
    grid-column: span 2;
}

.log-table-wrapper {
    margin-top: 1.5rem;
    overflow-x: auto;
    max-height: 400px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

#activity-log-table {
    width: 100%;
    border-collapse: collapse;
}

#activity-log-table th {
    text-align: left;
    padding: 1rem;
    border-bottom: 2px solid var(--glass-border);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#activity-log-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
    color: var(--text-color);
}

/* Advanced Generator Modal */
.gen-result-box {
    display: flex;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--glass-border);
}

#gen-output {
    flex: 1;
    background: none;
    border: none;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 1.2rem;
    color: var(--primary-color);
    outline: none;
}

.gen-toggles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.toggle-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background 0.2s;
}

.toggle-control:hover {
    background: rgba(255, 255, 255, 0.05);
}

.toggle-control input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
}

@media (max-width: 768px) {
    .activity-card {
        grid-column: span 1;
    }
    .gen-toggles {
        grid-template-columns: 1fr;
    }
}

/* Quick Access Folders Styling */
#quick-access-section {
    margin-bottom: 2rem;
    padding-top: 15px; /* Added padding to prevent hover clipping */
}

.section-header h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.quick-folders-wrapper {
    overflow-x: auto;
    padding-bottom: 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

.quick-folders-wrapper::-webkit-scrollbar {
    height: 5px;
}

.quick-folders-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.quick-folders-wrapper::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

.quick-folders-list {
    display: flex;
    gap: 1.25rem;
    min-width: min-content;
}

.folder-card {
    min-width: 180px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 1.25rem;
    border-radius: 1.25rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.folder-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
}

.folder-card.active {
    background: rgba(59, 130, 246, 0.1) !important;
    border-color: var(--primary-color) !important;
}

.folder-card-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.folder-card-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-card-info {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Back Button Styling (PRO) */
.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-right: 1rem;
    font-size: 1.1rem;
}

.back-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateX(-5px) scale(1.1);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}
