/* Custom font for a clean look */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #f6f8fa 0%, #e9eef2 100%);
    min-height: 100vh;
    margin: 0;
}

/* Mobile optimizations */
@media (max-width: 640px) {
    .min-h-screen {
        min-height: 100vh;
        padding: 0;
    }
    
    .bg-white {
        border-radius: 0;
        min-height: 100vh;
    }
}

/* Ensure content is properly spaced */
@media (max-width: 640px) {
    input, button, select {
        margin-bottom: 0.75rem;
    }
    
    #passwordDisplay {
        word-break: break-all;
        max-width: 100%;
    }
}

/* Tooltip styles */
[title] {
    position: relative;
}

[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Custom styles for checkboxes */
input[type="checkbox"] {
    cursor: pointer;
    border-color: #e2e8f0;
}

input[type="checkbox"]:hover {
    border-color: #0ea5e9;
}

/* Password strength meter */
#strengthBar {
    transition: width 0.3s ease, background-color 0.3s ease;
}

/* Styling for the range input */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    background: transparent;
    cursor: pointer;
    margin: 10px 0;
}

/* The track styles */
input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: linear-gradient(to right, #0ea5e9 var(--range-progress), #e2e8f0 var(--range-progress));
    border-radius: 4px;
    transition: background 0.3s ease;
}

input[type="range"]::-moz-range-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: #e2e8f0;
    border-radius: 4px;
}

/* The filled part of the track for Firefox */
input[type="range"]::-moz-range-progress {
    background: #0ea5e9;
    height: 8px;
    border-radius: 4px;
}

/* The thumb styles */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #0ea5e9;
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.2);
    transition: all 0.15s ease-in-out;
    margin-top: -6px; /* Center the thumb on the track */
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #0ea5e9;
    cursor: pointer;
    border-radius: 50%;
    border: none; /* Remove default border */
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.2);
    transition: all 0.15s ease-in-out;
}

/* Hover states */
input[type="range"]::-webkit-slider-thumb:hover {
    background: #0284c7;
    box-shadow: 0 0 0 6px rgba(14, 165, 233, 0.3);
}

input[type="range"]::-moz-range-thumb:hover {
    background: #0284c7;
    box-shadow: 0 0 0 6px rgba(14, 165, 233, 0.3);
}

#copyMessage {
    pointer-events: none;
    z-index: 50;
}

/* Loading spinner */
.loading-spinner {
    border: 3px solid rgba(14, 165, 233, 0.1);
    border-left-color: #0ea5e9;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Card styling */
.bg-white {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Mobile optimizations */
@media (max-width: 640px) {
    body {
        padding: 1rem;
        align-items: flex-start;
    }

    /* Improve tap targets */
    input[type="checkbox"] {
        width: 1.25rem;
        height: 1.25rem;
        margin-right: 0.5rem;
    }

    input[type="range"]::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }

    input[type="range"]::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }

    /* Adjust font sizes */
    #passwordDisplay {
        font-size: 0.875rem;
        padding: 0.75rem;
    }

    /* Hide tooltips on mobile */
    [title]:hover::after {
        display: none;
    }

    /* Optimize loading spinner */
    .loading-spinner {
        width: 20px;
        height: 20px;
        border-width: 2px;
    }

    /* Improve touch targets */
    button, 
    select,
    input[type="checkbox"] + label {
        min-height: 44px;
    }

    /* Optimize copy message */
    #copyMessage {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Smooth transitions for advanced options */
#advancedOptions {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.2s ease-out;
    opacity: 0;
}

#advancedOptions:not(.hidden) {
    max-height: 500px;
    opacity: 1;
}

/* Active states for touch devices */
@media (hover: none) {
    button:active {
        transform: scale(0.98);
    }

    input[type="range"]::-webkit-slider-thumb:active {
        transform: scale(1.1);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
        color: #e5e5e5;
    }

    .bg-white {
        background-color: #2d2d2d;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    }

    #passwordDisplay {
        background-color: #1a1a1a;
        border-color: #404040;
        color: #e5e5e5;
    }

    input[type="range"]::-webkit-slider-runnable-track {
        background: linear-gradient(to right, #0ea5e9 var(--range-progress), #404040 var(--range-progress));
    }

    select, input[type="checkbox"] {
        background-color: #1a1a1a;
        border-color: #404040;
        color: #e5e5e5;
    }

    /* Dark mode preset button styles */
    .bg-white.border {
        background-color: #1a1a1a !important;
        border-color: #404040 !important;
        color: #e5e5e5;
    }

    .bg-white.border:hover {
        background-color: #2d2d2d !important;
    }

    .bg-white.border:active {
        background-color: #404040 !important;
    }
}
