/* ========== Reset & Variables ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a2e;
    --bg-input: #0f0f1a;
    --accent: #00ff88;
    --accent-dim: #00cc6a;
    --accent-glow: rgba(0, 255, 136, 0.3);
    --accent-glow-strong: rgba(0, 255, 136, 0.6);
    --text-primary: #e0e0e0;
    --text-secondary: #8888aa;
    --text-muted: #555577;
    --border: #2a2a3e;
    --danger: #ff4444;
    --warning: #ffaa00;
    --success: #00ff88;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-mono: 'Courier New', 'Fira Code', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(0, 255, 136, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(0, 136, 255, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(136, 0, 255, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ========== Particles ========== */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--accent);
    border-radius: 50%;
    opacity: 0;
    animation: float-particle linear infinite;
}

@keyframes float-particle {
    0% { opacity: 0; transform: translateY(100vh) scale(0); }
    10% { opacity: 0.6; }
    90% { opacity: 0.6; }
    100% { opacity: 0; transform: translateY(-10vh) scale(1); }
}

/* ========== Container ========== */
.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== Header ========== */
.header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent), #00aaff);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    animation: pulse-glow 3s ease-in-out infinite;
    box-shadow: 0 0 20px var(--accent-glow);
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px var(--accent-glow); }
    50% { box-shadow: 0 0 35px var(--accent-glow-strong); }
}

.logo h1 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #00aaff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.header p {
    color: var(--text-secondary);
    font-size: 14px;
    letter-spacing: 0.5px;
}

/* ========== Card ========== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 255, 136, 0.05);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
}

.card:hover {
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 255, 136, 0.1);
}

/* ========== Options ========== */
.options-section {
    margin-bottom: 24px;
}

.option-group-title {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

/* Length Slider */
.length-control {
    margin-bottom: 24px;
}

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

.length-header label {
    font-size: 14px;
    color: var(--text-primary);
}

.length-value {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
    background: rgba(0, 255, 136, 0.1);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    min-width: 48px;
    text-align: center;
    transition: var(--transition);
}

.slider-container {
    position: relative;
    padding: 8px 0;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid var(--bg-card);
    box-shadow: 0 0 10px var(--accent-glow), 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 20px var(--accent-glow-strong), 0 2px 8px rgba(0, 0, 0, 0.3);
}

input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid var(--bg-card);
    box-shadow: 0 0 10px var(--accent-glow), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
}

.slider-labels span {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Checkboxes */
.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.checkbox-item:hover {
    border-color: rgba(0, 255, 136, 0.3);
    background: rgba(0, 255, 136, 0.03);
}

.checkbox-item.active {
    border-color: rgba(0, 255, 136, 0.4);
    background: rgba(0, 255, 136, 0.05);
}

.custom-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.checkbox-item.active .custom-checkbox {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.custom-checkbox svg {
    width: 12px;
    height: 12px;
    color: var(--bg-primary);
    opacity: 0;
    transform: scale(0);
    transition: var(--transition);
}

.checkbox-item.active .custom-checkbox svg {
    opacity: 1;
    transform: scale(1);
}

.checkbox-item input {
    display: none;
}

.checkbox-label {
    font-size: 13px;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.checkbox-label .label-hint {
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ========== Generate Button ========== */
.generate-section {
    margin-bottom: 28px;
}

.btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dim));
    color: var(--bg-primary);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    box-shadow: 0 6px 25px var(--accent-glow-strong);
    transform: translateY(-2px);
}

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

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary.generating {
    pointer-events: none;
}

/* ========== Divider ========== */
.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.divider-text {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    white-space: nowrap;
}

/* ========== Result Section ========== */
.result-section {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    pointer-events: none;
}

.result-section.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* Password Display */
.password-display {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    transition: var(--transition);
    min-height: 64px;
}

.password-display:hover {
    border-color: rgba(0, 255, 136, 0.3);
}

.password-display.copied {
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.password-text {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 18px;
    color: var(--text-primary);
    letter-spacing: 1.5px;
    word-break: break-all;
    line-height: 1.4;
    user-select: all;
    overflow-wrap: break-word;
}

.password-text.placeholder {
    color: var(--text-muted);
    font-style: italic;
    letter-spacing: 0;
    font-size: 14px;
}

.copy-btn-inline {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.copy-btn-inline:hover {
    background: rgba(0, 255, 136, 0.1);
    border-color: var(--accent);
    color: var(--accent);
    transform: scale(1.05);
}

.copy-btn-inline:active {
    transform: scale(0.95);
}

.copy-btn-inline svg {
    width: 20px;
    height: 20px;
    transition: var(--transition);
}

.copy-btn-inline.copied svg.copy-icon { display: none; }
.copy-btn-inline.copied svg.check-icon { display: block; }
.copy-btn-inline svg.check-icon { display: none; color: var(--accent); }

/* Strength + Copy Row */
.result-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* Strength Meter */
.strength-section {
    flex: 1;
}

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

.strength-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.strength-value {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: var(--transition);
}

.strength-value.weak { color: var(--danger); }
.strength-value.medium { color: var(--warning); }
.strength-value.strong { color: var(--accent); }
.strength-value.very-strong { color: #00ccff; }

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

.strength-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease, background 0.5s ease;
    width: 0%;
}

.strength-fill.weak { width: 25%; background: var(--danger); }
.strength-fill.medium { width: 50%; background: var(--warning); }
.strength-fill.strong { width: 75%; background: var(--accent); }
.strength-fill.very-strong { width: 100%; background: linear-gradient(90deg, var(--accent), #00ccff); }

/* Copy Button */
.btn-copy {
    padding: 10px 24px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-copy:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(0, 255, 136, 0.05);
    transform: translateY(-1px);
}

.btn-copy:active {
    transform: translateY(0);
}

.btn-copy svg {
    width: 16px;
    height: 16px;
}

.btn-copy.copied {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(0, 255, 136, 0.1);
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--bg-card);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px var(--accent-glow);
    z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* ========== Animations ========== */
@keyframes charReveal {
    0% { opacity: 0; transform: translateY(-10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.char-animate {
    display: inline-block;
    animation: charReveal 0.1s ease-out forwards;
    opacity: 0;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-3px); }
}

/* ========== Footer ========== */
.footer {
    text-align: center;
    margin-top: 24px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ========== Warning Overlay ========== */
.dev-warning-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.97);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--danger);
    font-family: var(--font-sans);
    text-align: center;
    padding: 40px;
    backdrop-filter: blur(20px);
}

.dev-warning-overlay .warning-icon {
    font-size: 72px;
    margin-bottom: 24px;
    animation: warningPulse 1s ease-in-out infinite;
}

.dev-warning-overlay h2 {
    font-size: 28px;
    margin-bottom: 16px;
    color: #ff4444;
}

.dev-warning-overlay p {
    font-size: 16px;
    color: #888;
    max-width: 400px;
    line-height: 1.6;
}

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

/* ========== Responsive ========== */
@media (max-width: 560px) {
    body { padding: 16px; }
    .card { padding: 24px 20px; }
    .logo h1 { font-size: 22px; }
    .logo-icon { width: 40px; height: 40px; font-size: 20px; }
    .password-text { font-size: 15px; }
    .checkbox-grid { grid-template-columns: 1fr; gap: 8px; }
    .result-actions { flex-direction: column; align-items: stretch; }
    .btn-copy { justify-content: center; }
    .length-value { font-size: 18px; }
}

@media (max-width: 360px) {
    .card { padding: 20px 16px; }
    .password-text { font-size: 13px; }
}

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

.btn:focus-visible,
.copy-btn-inline:focus-visible,
.btn-copy:focus-visible,
.checkbox-item:focus-visible,
input[type="range"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
