/* =========================================
   COMPREHENSIVE UI/UX POLISH OVERRIDES
   Modern Design System Enhancements
   ========================================= */

/* ===== ROOT VARIABLES OVERRIDE ===== */
:root {
    /* Enhanced Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 30px 60px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 40px rgba(0, 45, 246, 0.3);
    
    /* Enhanced Borders & Separators */
    --border-width: 1.5px;
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
}

/* ===== BODY & GLOBAL IMPROVEMENTS ===== */
html {
    scroll-behavior: smooth;
}

body {
    background: linear-gradient(135deg, #F0F4F8 0%, #D9E2EC 50%, #F0F4F8 100%);
    background-attachment: fixed;
    background-size: 400% 400%;
}

/* ===== SIDEBAR ENHANCEMENTS ===== */
.sidebar {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%) !important;
    border-left: 2px solid var(--border) !important;
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.12) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.sidebar-logo {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 900;
    letter-spacing: -0.02em;
    text-shadow: 0 4px 12px rgba(0, 45, 246, 0.1);
}

.sidebar-logo i {
    color: var(--primary) !important;
    filter: drop-shadow(0 4px 8px rgba(0, 45, 246, 0.2));
}

/* ===== MAIN CONTENT ENHANCEMENTS ===== */
.main-content {
    background: linear-gradient(135deg, #F8FAFC 0%, #EEF3F8 100%) !important;
    padding: 3rem !important;
}

/* ===== PAGE HEADER IMPROVEMENTS ===== */
.page-header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(248, 250, 252, 0.85) 100%) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.8) !important;
    border-radius: 1.25rem !important;
    padding: 2.5rem !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08) !important;
    margin-bottom: 3.5rem !important;
}

.page-title {
    font-size: 2.5rem !important;
    font-weight: 900 !important;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    font-size: 1.1rem !important;
    margin-top: 0.75rem !important;
    font-weight: 600;
}

/* ===== CARD IMPROVEMENTS ===== */
.card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%) !important;
    border: 1.5px solid rgba(226, 232, 240, 0.8) !important;
    border-radius: 1rem !important;
    padding: 2rem !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.5) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    border-radius: 1rem;
    z-index: 1;
}

.card:hover {
    border-color: var(--primary) !important;
    box-shadow: 0 30px 60px rgba(0, 45, 246, 0.2), 0 0 60px rgba(0, 45, 246, 0.15) !important;
    transform: translateY(-8px) !important;
}

.card:hover::before {
    opacity: 1 !important;
}

.card > * {
    position: relative;
    z-index: 2;
}

/* ===== BUTTON ENHANCEMENTS ===== */
.btn {
    font-weight: 700 !important;
    padding: 0.85rem 1.75rem !important;
    border-radius: 0.85rem !important;
    font-size: 0.95rem !important;
    letter-spacing: 0.02em;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.5s ease, height 0.5s ease;
    z-index: -1;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%) !important;
    color: white !important;
    box-shadow: 0 10px 30px rgba(0, 45, 246, 0.35) !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, rgba(0, 25, 180, 0.9) 100%) !important;
    transform: translateY(-4px) !important;
    box-shadow: 0 20px 50px rgba(0, 45, 246, 0.45) !important;
}

.btn-primary:active {
    transform: translateY(0) !important;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1.5px solid rgba(226, 232, 240, 0.8) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08) !important;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.95) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 12px 30px rgba(0, 45, 246, 0.15) !important;
    transform: translateY(-3px) !important;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #DC2626 100%) !important;
    color: white !important;
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.35) !important;
}

.btn-danger:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 20px 50px rgba(239, 68, 68, 0.45) !important;
}

.btn-ghost {
    background: transparent !important;
    border: 1.5px solid transparent !important;
    box-shadow: none !important;
}

.btn-ghost:hover {
    background: rgba(0, 45, 246, 0.08) !important;
    border-color: rgba(0, 45, 246, 0.2) !important;
    color: var(--primary) !important;
}

/* ===== FORM IMPROVEMENTS ===== */
.form-input {
    padding: 1.25rem 2rem !important;
    border: 1.5px solid rgba(226, 232, 240, 0.8) !important;
    border-radius: 0.85rem !important;
    background: rgba(255, 255, 255, 0.95) !important;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.form-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px var(--primary-light), 0 8px 24px rgba(0, 45, 246, 0.2) !important;
    transform: translateY(-2px) !important;
}

.form-group {
    margin-bottom: 2rem !important;
    animation: fade-up 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== PASSWORD CARD IMPROVEMENTS - PREMIUM DESIGN ===== */
.password-grid {
    gap: 3rem !important;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)) !important;
}

.password-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 100%), 
                radial-gradient(circle at 0% 0%, rgba(0, 45, 246, 0.03) 0%, transparent 50%) !important;
    border: 1.5px solid rgba(226, 232, 240, 0.9) !important;
    border-radius: 1.25rem !important;
    padding: 2rem !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1), 0 0 1px rgba(0, 0, 0, 0.08) !important;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
    gap: 1.25rem !important;
    position: relative !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}

/* Background layers for depth */
.password-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 45, 246, 0.08) 0%, transparent 50%, rgba(16, 185, 129, 0.04) 100%);
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 1.25rem;
    pointer-events: none;
    z-index: 0;
}

.password-card::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 1.25rem;
    background: conic-gradient(from 0deg, var(--primary), var(--success), var(--primary));
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: -1;
    filter: blur(8px);
}

.password-card > * {
    position: relative;
    z-index: 2;
}

.password-card:hover {
    border-color: rgba(0, 45, 246, 0.3) !important;
    transform: translateY(-4px) scale(1.01) !important;
    box-shadow: 0 12px 32px rgba(0, 45, 246, 0.12), 0 4px 12px rgba(0, 45, 246, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.5) !important;
}

.password-card:hover::before {
    opacity: 1 !important;
}

.password-card:hover::after {
    opacity: 0.3 !important;
}

.password-card:active {
    transform: translateY(-2px) scale(1.005) !important;
}

.password-icon {
    width: 72px !important;
    height: 72px !important;
    min-width: 72px !important;
    min-height: 72px !important;
    border-radius: 1rem !important;
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(0, 45, 246, 0.08) 100%), 
                radial-gradient(circle at 100% 0%, rgba(16, 185, 129, 0.1) 0%, transparent 60%) !important;
    font-size: 2rem !important;
    box-shadow: 0 8px 24px rgba(0, 45, 246, 0.2), inset 0 2px 4px rgba(255, 255, 255, 0.3) !important;
    color: var(--primary) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.password-card:hover .password-icon {
    background: linear-gradient(135deg, rgba(0, 45, 246, 0.06) 0%, rgba(0, 45, 246, 0.03) 100%), 
                radial-gradient(circle at 100% 0%, rgba(16, 185, 129, 0.1) 0%, transparent 60%) !important;
    box-shadow: 0 8px 24px rgba(0, 45, 246, 0.2), inset 0 2px 4px rgba(255, 255, 255, 0.35) !important;
    transform: scale(1.05) !important;
}

.password-title {
    font-size: 1.1rem !important;
    font-weight: 800 !important;
    margin: 0 !important;
    color: var(--text-primary) !important;
    letter-spacing: -0.01em;
    line-height: 1.4;
}

.password-username {
    font-size: 0.9rem !important;
    color: var(--text-secondary) !important;
    margin: 0.25rem 0 0 0 !important;
    font-weight: 500;
    letter-spacing: 0.01em;
}

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

.password-card .password-meta {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.75rem !important;
    margin-top: 1rem !important;
    padding-top: 1rem !important;
    border-top: 1px solid rgba(226, 232, 240, 0.5) !important;
}

/* Badge styling within password cards */
.password-card .badge {
    font-size: 0.75rem !important;
    padding: 0.35rem 0.75rem !important;
    backdrop-filter: blur(8px) !important;
}

.password-card .badge-shared {
    background: rgba(16, 185, 129, 0.12) !important;
    border-color: rgba(16, 185, 129, 0.35) !important;
}

.password-card .badge-private {
    background: rgba(239, 68, 68, 0.12) !important;
    border-color: rgba(239, 68, 68, 0.35) !important;
}

/* Password Actions Styling */
.password-actions {
    display: flex !important;
    gap: 0.5rem !important;
    margin-top: auto !important;
    padding-top: 1rem !important;
    border-top: 1px solid rgba(226, 232, 240, 0.5) !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
}

.password-card .btn-icon {
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    border-radius: 0.7rem !important;
    background: rgba(226, 232, 240, 0.3) !important;
    border: 1px solid rgba(226, 232, 240, 0.5) !important;
    color: #0069ff !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.password-card .btn-icon:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(0, 45, 246, 0.05) 100%) !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    box-shadow: 0 6px 16px rgba(0, 45, 246, 0.2) !important;
    transform: translateY(-3px) scale(1.08) !important;
}

.password-card .btn-icon.text-danger:hover {
    background: rgba(239, 68, 68, 0.12) !important;
    border-color: var(--danger) !important;
    color: var(--danger) !important;
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.2) !important;
}

.password-card .btn-icon i {
    font-size: 1.1rem !important;
    color: inherit !important;
}

/* Ensure all btn-icon elements in passwords page have the correct color */
.passwords-page .btn-icon,
.passwords-page .btn-icon i,
.btn-icon {
    color: #0069ff !important;
}

/* Card Entry Animation */
.password-card {
    animation: card-entry 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards !important;
}

@keyframes card-entry {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.password-grid > :nth-child(1) { animation-delay: 0.05s !important; }
.password-grid > :nth-child(2) { animation-delay: 0.1s !important; }
.password-grid > :nth-child(3) { animation-delay: 0.15s !important; }
.password-grid > :nth-child(4) { animation-delay: 0.2s !important; }
.password-grid > :nth-child(5) { animation-delay: 0.25s !important; }
.password-grid > :nth-child(n+6) { animation-delay: 0.3s !important; }

/* Password Card Info Improvements */
.password-card .password-info {
    flex: 1;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.25rem !important;
    min-width: 0;
}

.password-card .flex.items-center {
    align-items: center !important;
    gap: 0.75rem !important;
}

.password-card .password-title {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
}

.password-card:hover .password-title {
    color: rgba(0, 45, 246, 0.8) !important;
    transition: color 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.password-card .password-username {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 0.85rem !important;
    letter-spacing: 0.01em;
}

/* Responsive password card */
@media (max-width: 768px) {
    .password-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    .password-card {
        flex-direction: row !important;
        align-items: center !important;
        padding: 1.5rem !important;
        gap: 1rem !important;
    }
    
    .password-icon {
        width: 56px !important;
        height: 56px !important;
        font-size: 1.5rem !important;
    }
    
    .password-actions {
        margin-top: 0 !important;
        padding-top: 0 !important;
        padding-left: 1rem !important;
        border-top: none !important;
        border-left: 1px solid rgba(226, 232, 240, 0.5) !important;
        gap: 0.25rem !important;
    }
    
    .password-card .btn-icon {
        width: 36px !important;
        height: 36px !important;
    }
    
    .password-card .btn-icon i {
        font-size: 1rem !important;
    }
}

/* ===== STAT CARD IMPROVEMENTS ===== */
.stats-grid {
    gap: 2.5rem !important;
    margin-bottom: 4rem !important;
}

.stat-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.7) !important;
    border-radius: 1.5rem !important;
    padding: 2.25rem !important;
    box-shadow: 0 15px 40px rgba(31, 38, 135, 0.15) !important;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
    gap: 1.75rem !important;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(0, 45, 246, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 50%;
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-10px) !important;
    box-shadow: 0 30px 70px rgba(0, 45, 246, 0.25) !important;
    border-color: rgba(0, 45, 246, 0.4) !important;
}

.stat-card:hover::after {
    opacity: 1 !important;
}

.stat-value {
    font-size: 2.75rem !important;
    font-weight: 900 !important;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.stat-icon {
    width: 72px !important;
    height: 72px !important;
    border-radius: 1rem !important;
    font-size: 2rem !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12) !important;
    flex-shrink: 0;
}

/* ===== BADGE ENHANCEMENTS ===== */
.badge {
    padding: 0.5rem 1rem !important;
    border-radius: 999px !important;
    font-weight: 800 !important;
    letter-spacing: 0.03em;
    border-width: 1.5px !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.badge-private {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

.badge-shared {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}

/* ===== MODAL IMPROVEMENTS ===== */
.modal-overlay {
    background: rgba(15, 23, 42, 0.85) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    animation: fade-in 0.25s ease !important;
}

.modal-overlay.active {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 1rem !important;
}

.modal {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 100%) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.8) !important;
    border-radius: 1.25rem !important;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.25) !important;
    animation: modal-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes modal-slide-in {
    from { opacity: 0; transform: scale(0.95) translateY(-20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-header {
    border-bottom: 2px solid rgba(226, 232, 240, 0.5) !important;
}

.modal-title {
    font-size: 1.5rem !important;
    font-weight: 900 !important;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== LOADING & ANIMATIONS ===== */
.spinner {
    width: 50px !important;
    height: 50px !important;
    border: 4px solid rgba(0, 45, 246, 0.1) !important;
    border-top-color: var(--primary) !important;
    animation: spin 1s linear infinite !important;
}

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

.skeleton {
    background: linear-gradient(90deg, rgba(226, 232, 240, 0.5) 0%, rgba(226, 232, 240, 0.8) 50%, rgba(226, 232, 240, 0.5) 100%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== ACCESSIBILITY & INTERACTIONS ===== */
*:focus-visible {
    outline: 2px solid var(--primary) !important;
    outline-offset: 3px !important;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.form-input:focus,
button:focus-visible {
    outline: none !important;
}

/* Smooth scrollbars */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(226, 232, 240, 0.3);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 45, 246, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    box-shadow: 0 0 15px rgba(0, 45, 246, 0.35);
}

/* ===== UTILITY IMPROVEMENTS ===== */
.empty-state {
    padding: 4rem 2rem !important;
    text-align: center;
}

.empty-state i {
    font-size: 4.5rem !important;
    color: var(--primary-light) !important;
    margin-bottom: 1.5rem !important;
    opacity: 0.7 !important;
    filter: drop-shadow(0 4px 12px rgba(0, 45, 246, 0.1));
}

.empty-state h3 {
    font-size: 1.5rem !important;
    margin-bottom: 0.75rem !important;
}

/* Enhanced link styling */
a {
    color: var(--primary);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 1024px) {
    .main-content {
        padding: 2rem !important;
    }
    
    .page-header {
        flex-direction: column;
        gap: 1.5rem;
        align-items: flex-start !important;
    }
    
    .page-title {
        font-size: 2rem !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ===== SELECTION STYLING ===== */
::selection {
    background: var(--primary-light);
    color: var(--primary);
}

::-moz-selection {
    background: var(--primary-light);
    color: var(--primary);
}

/* Improved focus rings for accessibility */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 4px var(--primary-light);
}

/* Enhanced input animations */
.form-input {
    --border-color: var(--border);
}

.form-input:focus {
    --border-color: var(--primary);
}

/* Smooth transitions for colors */
.form-input,
.btn,
.card,
.password-card,
.stat-card {
    --transition-speed: 0.25s;
    --timing: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Loading animation improvement */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--primary-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Better empty states */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3.5rem;
    color: var(--primary-light);
    margin-bottom: 1rem;
    display: block;
    opacity: 0.6;
}

.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.125rem;
}

/* Input group improvements */
.input-group {
    position: relative;
}

.input-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.2s;
}

.form-input:focus ~ .input-icon {
    color: var(--primary);
}

/* Modal enhancements */
.modal {
    background: var(--bg-surface);
    border-radius: 0.875rem;
    border: 1px solid var(--border);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.15),
        0 0 1px rgba(0, 0, 0, 0.1) inset;
    animation: modal-bounce 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 90vh;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modal-bounce {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Toast notifications enhancement */
.toast-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    animation: slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast.success {
    border-left: 4px solid var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.toast.error {
    border-left: 4px solid var(--danger);
    background: rgba(239, 68, 68, 0.05);
}

.toast.warning {
    border-left: 4px solid var(--warning);
    background: rgba(245, 158, 11, 0.05);
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Better transitions for lists */
.password-grid,
.stats-grid {
    animation: fade-up 0.4s ease;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Link hover effects */
a {
    transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

a:hover {
    color: var(--primary);
}

/* Icon animations */
.icon-spin {
    animation: spin 1s linear infinite;
}

.icon-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Better hover states for interactive elements */
.password-card,
.stat-card,
.card {
    --transition-duration: 0.3s;
}

.password-card:active,
.stat-card:active,
.card:active {
    transform: translateY(0);
}

/* Improved search input styling */
.search-box {
    position: relative;
    width: 100%;
    max-width: 280px;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    padding-left: 2.5rem !important;
}

/* Better group styling */
.form-group {
    animation: fade-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.form-group:nth-child(1) { animation-delay: 0.05s; }
.form-group:nth-child(2) { animation-delay: 0.1s; }
.form-group:nth-child(3) { animation-delay: 0.15s; }

/* Improved scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
    transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Selection styling */
::selection {
    background: var(--primary-light);
    color: var(--primary);
}

::-moz-selection {
    background: var(--primary-light);
    color: var(--primary);
}

/* Disabled state improvements */
[disabled],
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Page transitions */
@media (prefers-reduced-motion: no-preference) {
    * {
        --transition-speed: 0.25s;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Subtle page background animation */
@keyframes subtle-drift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Improved file upload styling */
input[type="file"] {
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    background: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

input[type="file"]::file-selector-button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* Checkbox and radio improvements */
input[type="checkbox"],
input[type="radio"] {
    cursor: pointer;
    accent-color: var(--primary);
}

/* Better table styling if used */
table {
    border-collapse: collapse;
    width: 100%;
}

th {
    background: var(--bg-surface-hover);
    padding: 1rem;
    text-align: right;
    font-weight: 600;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

tr:hover {
    background: var(--primary-light);
}

/* Code block styling */
code {
    background: var(--bg-surface-hover);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    color: var(--danger);
}

pre {
    background: var(--bg-surface-hover);
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    border: 1px solid var(--border);
}

pre code {
    background: none;
    padding: 0;
    color: inherit;
}
