/* Import Google Fonts in HTML or CSS */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    /* Light Theme Variables (Default) */
    --bg-gradient: linear-gradient(135deg, #f5f3ff 0%, #e0e7ff 50%, #ecfeff 100%);
    --container-bg: rgba(255, 255, 255, 0.8);
    --container-border: rgba(255, 255, 255, 0.6);
    --card-bg: rgba(255, 255, 255, 0.6);
    --card-border: rgba(255, 255, 255, 0.5);
    --text-title: #1e1b4b;
    --text-h3: #312e81;
    --text-label: #4338ca;
    --text-body: #374151;
    --text-muted: #6b7280;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --accent-hover: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --input-bg: rgba(255, 255, 255, 0.95);
    --input-border: #e0e7ff;
    --input-focus-border: #818cf8;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(99, 102, 241, 0.05), 0 4px 6px -2px rgba(99, 102, 241, 0.02);
    --shadow-lg: 0 20px 40px -5px rgba(0, 0, 0, 0.06), 0 10px 20px -5px rgba(0, 0, 0, 0.04);
    --result-bg: #f8fafc;
    --result-border: #e2e8f0;
    
    --strength-bg: #e2e8f0;
    --strength-weak: #ef4444;
    --strength-medium: #f59e0b;
    --strength-strong: #10b981;
    --strength-very-strong: #3b82f6;

    --transition-speed: 0.3s;
}

/* Dark Theme Variables */
.dark-theme {
    --bg-gradient: linear-gradient(135deg, #090d16 0%, #0f172a 60%, #1e1b4b 100%);
    --container-bg: rgba(15, 23, 42, 0.7);
    --container-border: rgba(255, 255, 255, 0.08);
    --card-bg: rgba(30, 41, 59, 0.45);
    --card-border: rgba(255, 255, 255, 0.05);
    --text-title: #f8fafc;
    --text-h3: #e2e8f0;
    --text-label: #a5b4fc;
    --text-body: #cbd5e1;
    --text-muted: #94a3b8;
    --accent: #818cf8;
    --accent-glow: rgba(129, 140, 248, 0.4);
    --accent-gradient: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
    --accent-hover: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --input-bg: rgba(15, 23, 42, 0.85);
    --input-border: rgba(255, 255, 255, 0.1);
    --input-focus-border: #818cf8;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --result-bg: rgba(15, 23, 42, 0.6);
    --result-border: rgba(255, 255, 255, 0.08);
    
    --strength-bg: rgba(255, 255, 255, 0.1);
    --strength-weak: #f87171;
    --strength-medium: #fbbf24;
    --strength-strong: #34d399;
    --strength-very-strong: #60a5fa;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-body);
    min-height: 100vh;
    padding: 40px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background var(--transition-speed) ease, color var(--transition-speed) ease;
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--container-bg);
    border: 1px solid var(--container-border);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}

.theme-toggle span {
    font-size: 20px;
    transition: transform 0.5s ease;
}

/* Light Theme Toggle Icon Visibility */
.light-theme #theme-toggle .icon-moon {
    display: none;
}
.light-theme #theme-toggle .icon-sun {
    display: block;
}

/* Dark Theme Toggle Icon Visibility */
.dark-theme #theme-toggle .icon-sun {
    display: none;
}
.dark-theme #theme-toggle .icon-moon {
    display: block;
}

/* App Container */
.container {
    max-width: 900px;
    width: 100%;
    background: var(--container-bg);
    border: 1px solid var(--container-border);
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: background var(--transition-speed) ease, border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

/* Header & Logo styling */
.app-header {
    text-align: center;
    margin-bottom: 35px;
}

.logo-wrapper {
    width: 96px;
    height: 96px;
    margin: 0 auto 15px auto;
    border-radius: 24px;
    background: var(--accent-gradient);
    padding: 3px;
    box-shadow: 0 10px 30px var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.logo-wrapper:hover {
    transform: scale(1.08) rotate(5deg);
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 21px;
}

.app-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-title);
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-header .subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Form Layout */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 35px;
}

.form-group {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 24px;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background var(--transition-speed) ease;
}

.form-group:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.form-group h3 {
    color: var(--text-h3);
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-group {
    margin-bottom: 20px;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-label);
    cursor: pointer;
}

/* Custom Number and Text Inputs */
input[type="number"], 
input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: 10px;
    color: var(--text-body);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.25s ease;
}

input[type="number"]:focus, 
input[type="text"]:focus {
    border-color: var(--input-focus-border);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Length Slider and Number Sync styling */
.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.range-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--input-border);
    outline: none;
    transition: background 0.3s ease;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: transform 0.1s ease, background 0.3s ease;
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.range-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: transform 0.1s ease, background 0.3s ease;
}

.range-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

.length-badge {
    background: var(--accent-gradient);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    box-shadow: 0 4px 10px var(--accent-glow);
}

.length-num-input {
    width: 65px !important;
    text-align: center;
    padding: 8px 5px !important;
}

/* Custom Checkbox Group styling */
.checkbox-group {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    cursor: pointer;
    padding: 10px 12px;
    border-radius: 12px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.checkbox-group:hover {
    background-color: var(--input-border);
    transform: translateX(3px);
}

/* Custom appearance checkboxes */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--accent);
    border-radius: 6px;
    margin-right: 12px;
    cursor: pointer;
    position: relative;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: transparent;
    flex-shrink: 0;
}

input[type="checkbox"]:checked {
    background: var(--accent-gradient);
    border-color: transparent;
}

input[type="checkbox"]:checked::after {
    content: "✓";
    position: absolute;
    color: white;
    font-size: 13px;
    font-weight: 800;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.checkbox-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-body);
    user-select: none;
}

/* Generate Button */
.generate-btn {
    width: 100%;
    padding: 16px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 16px;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 20px var(--accent-glow);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.generate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px var(--accent-glow);
    filter: brightness(1.05);
}

.generate-btn:active {
    transform: translateY(-1px);
}

/* Results Section styling */
.result-section {
    background: var(--result-bg);
    border: 1.5px dashed var(--result-border);
    padding: 24px;
    border-radius: 20px;
    transition: all var(--transition-speed) ease;
}

/* Password Box display wrapper */
.password-card {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 15px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-speed) ease;
}

.password-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}

.password-card:last-child {
    margin-bottom: 0;
}

.password-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.password-display {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-title);
    word-break: break-all;
    min-height: 35px;
    display: flex;
    align-items: center;
    flex: 1;
}

/* Copy Button custom aesthetics */
.copy-btn {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 10px var(--accent-glow);
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px var(--accent-glow);
    filter: brightness(1.1);
}

.copy-btn.copied {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

/* Strength Meter */
.strength-meter {
    width: 100%;
}

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

.strength-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.strength-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.strength-bar {
    width: 100%;
    height: 6px;
    background: var(--strength-bg);
    border-radius: 3px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0;
    border-radius: 3px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.4s ease;
}

/* Strength meter colors */
.strength-weak { 
    background-color: var(--strength-weak); 
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}
.strength-medium { 
    background-color: var(--strength-medium); 
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}
.strength-strong { 
    background-color: var(--strength-strong); 
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}
.strength-very-strong { 
    background-color: var(--strength-very-strong); 
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

/* Messages / Toast Alerts styling */
.error {
    color: var(--strength-weak);
    font-weight: 600;
    font-size: 0.95rem;
    text-align: center;
    padding: 15px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 12px;
}

/* Responsive Overrides */
@media (max-width: 600px) {
    body {
        padding: 20px 10px;
    }
    
    .container {
        padding: 24px 16px;
        border-radius: 20px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .app-header h1 {
        font-size: 1.8rem;
    }
    
    .password-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .copy-btn {
        width: 100%;
        justify-content: center;
    }
}