/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.5);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(16, 185, 129, 0.7);
}

/* Animated gradient background */
.bg-gradient-animated {
    background: linear-gradient(135deg, #0a0a0a, #1a1a2e, #16213e, #0f3460);
    background-size: 400% 400%;
    animation: gradient-xy 15s ease infinite;
}

/* Glassmorphism effect helper */
.glass {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Gradient text */
.gradient-text {
    background: linear-gradient(45deg, #10b981, #06b6d4, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Password display border animation - Flowing gradient effect */
.password-display-active::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(
        90deg,
        #10b981 0%,
        #06b6d4 25%,
        #a855f7 50%,
        #06b6d4 75%,
        #10b981 100%
    );
    border-radius: 1rem;
    opacity: 0.6;
    z-index: -1;
    filter: blur(8px);
    animation: border-flow 4s ease-in-out infinite;
    background-size: 400% 100%;
    will-change: background-position;
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    .password-display-active::before {
        animation: none;
        background-size: 100% 100%;
        opacity: 0.4;
    }
}

/* Range slider custom styling */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: linear-gradient(to right, #10b981 0%, #10b981 var(--value), rgba(255,255,255,0.1) var(--value), rgba(255,255,255,0.1) 100%);
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #10b981;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    transition: all 0.3s ease;
}
input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.8);
}
input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #10b981;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    border: none;
    transition: all 0.3s ease;
}
input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.8);
}

/* Particle animation */
.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #10b981;
    border-radius: 50%;
    opacity: 0.5;
    animation: float 20s infinite linear;
}

/* Button ripple effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}
.btn-ripple::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.6s, height 0.6s;
}
.btn-ripple:active::after {
    width: 300px;
    height: 300px;
}

/* Notification positioning */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}
.notification.show {
    transform: translateX(0);
}

/* Modal backdrop */
.modal-backdrop {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* History card delete animation */
.history-card.deleting {
    transform: translateX(-100%);
    opacity: 0;
    transition: all 0.3s ease;
}

/* Custom Tooltip Styles */
[data-tooltip] {
    position: relative;
    cursor: pointer;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid;
    border-image: linear-gradient(135deg,
        rgba(16, 185, 129, 0.5),
        rgba(6, 182, 212, 0.5),
        rgba(168, 85, 247, 0.5)
    ) 1;
    border-radius: 8px;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(16, 185, 129, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-2px);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.95);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

[data-tooltip]:hover::after {
    transform: translateX(-50%) translateY(4px);
}

/* Reduced motion support for accessibility */
@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;
    }

    /* Keep essential animations but make them instant */
    .bg-gradient-animated {
        animation: none;
    }

    /* Disable particle animations */
    #particles * {
        animation: none !important;
    }

    /* Make tooltips instant for reduced motion */
    [data-tooltip]::before,
    [data-tooltip]::after {
        transition: none !important;
    }
}

/* Print Stylesheet */
@media print {
    /* Hide unnecessary elements */
    #particles,
    .notification,
    button,
    input[type="range"],
    input[type="checkbox"],
    #alternativePasswords,
    #aiSuggestions,
    #breachCheck,
    .tab,
    #scrollIndicatorLeft,
    #scrollIndicatorRight {
        display: none !important;
    }

    /* Ensure content is visible */
    body {
        background: white !important;
        color: black !important;
    }

    /* Show passwords in clear text for printing */
    #password {
        color: black !important;
        font-size: 14pt;
    }

    /* Style history for printing */
    .glass {
        background: white !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }

    /* Make text readable */
    * {
        color: black !important;
        background: transparent !important;
    }

    /* Add page breaks */
    h1, h2, h3 {
        page-break-after: avoid;
    }

    .history-card {
        page-break-inside: avoid;
        margin-bottom: 1cm;
    }

    /* Print header */
    @page {
        margin: 2cm;
    }

    /* Add print-only header */
    body::before {
        content: "UltraPass Pro - Password List";
        display: block;
        font-size: 18pt;
        font-weight: bold;
        margin-bottom: 1cm;
        text-align: center;
    }
}

/* Keyboard shortcut hint styling */
.kbd-hint {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-family: monospace;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    margin-left: 8px;
}

/* ========== PREMIUM ENTERPRISE ENHANCEMENTS ========== */

/* Enhanced Button Hover - Lift Effect */
.btn-ripple,
button:not(.tab) {
    transform: translateY(0);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-ripple:hover,
button:not(.tab):hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.4),
                0 4px 10px -2px rgba(0, 0, 0, 0.3);
}

.btn-ripple:active,
button:not(.tab):active {
    transform: translateY(0);
    transition: all 0.1s;
}

/* Glow on Hover for Primary Buttons */
.bg-gradient-to-r:hover {
    filter: drop-shadow(0 0 15px rgba(16, 185, 129, 0.6))
            drop-shadow(0 0 30px rgba(6, 182, 212, 0.4));
}

/* Card 3D Hover Depth */
.glass {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.glass:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow:
        0 20px 60px -10px rgba(16, 185, 129, 0.3),
        0 0 40px rgba(6, 182, 212, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Copy Success Floating Animation */
@keyframes float-up-fade {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateY(-15px) scale(1.1);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
}

.copy-success-floater {
    position: absolute;
    top: -10px;
    right: 10px;
    animation: float-up-fade 1s ease-out forwards;
    color: #10b981;
    font-weight: 700;
    font-size: 0.875rem;
    pointer-events: none;
    z-index: 100;
    text-shadow: 0 2px 10px rgba(16, 185, 129, 0.5);
}

/* Success Pulse Animation */
@keyframes success-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
}

.success-pulse {
    animation: success-pulse 0.6s ease-out;
}

/* Staggered List Animations */
@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#historyList > div:nth-child(1) { animation: slide-up 0.3s ease-out 0.05s both; }
#historyList > div:nth-child(2) { animation: slide-up 0.3s ease-out 0.1s both; }
#historyList > div:nth-child(3) { animation: slide-up 0.3s ease-out 0.15s both; }
#historyList > div:nth-child(4) { animation: slide-up 0.3s ease-out 0.2s both; }
#historyList > div:nth-child(5) { animation: slide-up 0.3s ease-out 0.25s both; }
#historyList > div:nth-child(6) { animation: slide-up 0.3s ease-out 0.3s both; }
#historyList > div:nth-child(7) { animation: slide-up 0.3s ease-out 0.35s both; }
#historyList > div:nth-child(8) { animation: slide-up 0.3s ease-out 0.4s both; }
#historyList > div:nth-child(9) { animation: slide-up 0.3s ease-out 0.45s both; }
#historyList > div:nth-child(10) { animation: slide-up 0.3s ease-out 0.5s both; }

/* Enhanced Focus Indicators */
*:focus-visible {
    outline: 2px solid #10b981;
    outline-offset: 4px;
    border-radius: 8px;
    transition: outline 0.2s ease, box-shadow 0.2s ease;
}

button:focus-visible {
    outline: 3px solid #10b981;
    outline-offset: 2px;
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.2);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #10b981;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15),
                inset 0 0 0 1px rgba(16, 185, 129, 0.3);
}

/* Gradient Border Effect */
.gradient-border-card {
    position: relative;
    background-clip: padding-box;
}

.gradient-border-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 2px;
    pointer-events: none;
    background: linear-gradient(
        135deg,
        #10b981 0%,
        #06b6d4 50%,
        #a855f7 100%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box,
                  linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box,
          linear-gradient(#fff 0 0);
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gradient-border-card:hover::before {
    opacity: 1;
}

/* Loading Skeleton Animations */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0.05) 0%,
        rgba(255,255,255,0.15) 50%,
        rgba(255,255,255,0.05) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* Typography Refinements */
body {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "kern" 1, "liga" 1;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    text-rendering: optimizeLegibility;
}

.text-balance {
    text-wrap: balance;
}

/* Hardware Acceleration */
.hw-accelerated {
    transform: translateZ(0);
    will-change: transform, opacity;
    backface-visibility: hidden;
    perspective: 1000px;
}

.glass,
.btn-ripple,
#passwordDisplay,
.particle {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Enhanced Option Toggle Animation */
.option-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.option-item.active {
    animation: check-bounce 0.4s ease-out;
}

@keyframes check-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Enhanced Tab Hover */
.tab {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.tab.active {
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4),
                0 0 40px rgba(16, 185, 129, 0.2);
}

/* Password Display Enhancement */
#passwordDisplay {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#passwordDisplay:hover {
    transform: scale(1.01);
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.3);
}

/* Notification Enhancement */
.notification {
    backdrop-filter: blur(20px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(16, 185, 129, 0.3);
}

/* Empty State Float Animation */
@keyframes float-gentle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.empty-icon {
    animation: float-gentle 3s ease-in-out infinite;
}

/* Progress Bar Glow */
.strength-bar {
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.3s ease,
                box-shadow 0.3s ease;
}

.strength-strong {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.6),
                0 0 40px rgba(16, 185, 129, 0.3);
}

.strength-medium {
    box-shadow: 0 0 15px rgba(234, 179, 8, 0.6),
                0 0 30px rgba(234, 179, 8, 0.3);
}

.strength-weak {
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.6),
                0 0 20px rgba(239, 68, 68, 0.3);
}
