/* ==========================================================================
   SecurePass — Password Generator UI
   ========================================================================== */

:root {
    --bg: #0a0e17;
    --bg-card: #12182a;
    --bg-input: #1a2236;
    --bg-hover: #222d45;
    --border: rgba(255, 255, 255, 0.08);
    --border-active: rgba(6, 182, 212, 0.5);
    --text: #f0f4f8;
    --text-muted: #8b9cb3;
    --text-dim: #5a6a82;
    --accent: #06b6d4;
    --accent-hover: #22d3ee;
    --accent-glow: rgba(6, 182, 212, 0.25);
    --accent-soft: rgba(6, 182, 212, 0.12);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --strength-very-weak: #ef4444;
    --strength-weak: #f97316;
    --strength-medium: #eab308;
    --strength-strong: #22c55e;
    --strength-very-strong: #06b6d4;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --font-mono: 'Cascadia Code', 'Fira Code', Consolas, monospace;
    --transition: 200ms ease;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image:
        radial-gradient(ellipse 70% 50% at 20% -10%, rgba(6, 182, 212, 0.12), transparent),
        radial-gradient(ellipse 50% 40% at 90% 110%, rgba(99, 102, 241, 0.08), transparent);
}

.icon { width: 18px; height: 18px; flex-shrink: 0; }

/* Main */
.main-content { flex: 1; padding: 1.5rem 0 2rem; }

/* Hero */
.hero-section { text-align: center; margin-bottom: 2rem; }
.hero-badge {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.35rem 0.9rem; background: var(--accent-soft);
    border: 1px solid var(--border-active); border-radius: 999px;
    font-size: 0.78rem; font-weight: 600; color: var(--accent);
    margin-bottom: 0.75rem; letter-spacing: 0.03em; text-transform: uppercase;
}
.badge-dot {
    width: 7px; height: 7px; background: var(--accent);
    border-radius: 50%; animation: pulse 2s infinite;
}
.hero-title {
    font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 800;
    letter-spacing: -0.03em; margin: 0 0 0.5rem;
    background: linear-gradient(135deg, #fff 30%, var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-description { color: var(--text-muted); max-width: 520px; margin: 0 auto; font-size: 1rem; }

/* Grid */
.app-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 1.25rem; align-items: start;
}

/* Cards */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden;
}
.card-header {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02); flex-wrap: wrap;
}
.analysis-source-badge {
    margin-left: auto; font-size: 0.7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em;
    padding: 0.3rem 0.65rem; border-radius: 999px;
    background: var(--accent-soft); color: var(--accent);
    border: 1px solid var(--border-active);
}
.analysis-source-badge.is-custom {
    background: rgba(245, 158, 11, 0.12); color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.35);
}
.custom-password-group { margin-bottom: 0; }
.btn-strengthen {
    width: 100%; margin-top: 0.75rem;
    background: linear-gradient(135deg, #0891b2, #06b6d4); color: #000;
    box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-strengthen:hover:not(:disabled) {
    background: linear-gradient(135deg, #06b6d4, #22d3ee);
    box-shadow: 0 6px 24px var(--accent-glow);
}
.section-divider {
    display: flex; align-items: center; gap: 1rem;
    margin: 1.25rem 0; color: var(--text-dim); font-size: 0.72rem;
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
}
.section-divider::before,
.section-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}
.section-divider span { white-space: nowrap; }
.panel-analysis .card-header { justify-content: flex-start; }
.card-header-icon {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--accent-soft); color: var(--accent);
}
.card-header-icon svg { width: 20px; height: 20px; }
.card-header-icon-accent { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.card-title { font-size: 1rem; font-weight: 700; margin: 0; }
.card-body { padding: 1.25rem; }

/* Alert */
.alert-box { display: none; padding: 0.75rem 1rem; border-radius: var(--radius); font-size: 0.875rem; font-weight: 500; margin-bottom: 1rem; }
.alert-box.show { display: block; animation: slideDown 0.25s ease; }
.alert-warning { background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.3); color: #fbbf24; }
.alert-danger { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: #f87171; }

/* Password input */
.form-label {
    display: block; font-size: 0.75rem; font-weight: 600;
    color: var(--text-muted); margin-bottom: 0.5rem;
    text-transform: uppercase; letter-spacing: 0.06em;
}
.password-field-group { margin-bottom: 1.25rem; }
.password-input-group {
    display: flex; align-items: stretch;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.password-input-group:focus-within {
    border-color: var(--border-active);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.password-input {
    flex: 1; min-width: 0; background: transparent; border: none;
    color: var(--text); font-family: var(--font-mono); font-size: 0.95rem;
    padding: 0.9rem 1rem; outline: none;
}
.password-input::placeholder { color: var(--text-dim); }
.password-input.password-generated { animation: flash 0.4s ease; }
.password-input-actions {
    display: flex; align-items: stretch;
    border-left: 1px solid var(--border);
}
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
    padding: 0 0.85rem; background: transparent; border: none;
    color: var(--text-muted); cursor: pointer; font-size: 0.8rem; font-weight: 600;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn:active { transform: scale(0.97); }
.icon-btn-accent { color: var(--accent); }
.icon-btn-accent:hover { background: var(--accent-soft); color: var(--accent-hover); }
.icon-btn.copy-success { background: rgba(16,185,129,0.15); color: var(--success); }
.icon-btn .icon-eye-off { display: none; }
.icon-btn.is-visible .icon-eye { display: none; }
.icon-btn.is-visible .icon-eye-off { display: block; }
.form-text { display: block; margin-top: 0.4rem; font-size: 0.78rem; color: var(--text-dim); }

/* Length slider */
.length-control { margin-bottom: 1.25rem; }
.length-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; }
.length-value-wrap { display: flex; align-items: baseline; gap: 0.25rem; }
.length-value { font-size: 1.75rem; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1; }
.length-unit { font-size: 0.75rem; color: var(--text-dim); font-weight: 500; }
.custom-range {
    width: 100%; height: 6px; -webkit-appearance: none; appearance: none;
    background: var(--bg-input); border-radius: 999px; outline: none;
    cursor: pointer; touch-action: none;
}
.custom-range::-webkit-slider-thumb {
    -webkit-appearance: none; width: 20px; height: 20px;
    background: var(--accent); border-radius: 50%; cursor: pointer;
    box-shadow: 0 2px 8px var(--accent-glow); transition: transform var(--transition);
}
.custom-range::-webkit-slider-thumb:hover { transform: scale(1.15); }
.custom-range::-moz-range-thumb {
    width: 20px; height: 20px; background: var(--accent);
    border: none; border-radius: 50%; cursor: pointer;
}
.custom-range::-moz-range-track { height: 6px; background: var(--bg-input); border-radius: 999px; }
.length-hint { margin-top: 0.35rem; }
.range-labels { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--text-dim); margin-top: 0.3rem; }

/* Option chips */
.options-fieldset { border: none; padding: 0; margin: 0 0 1rem; }
.options-fieldset legend { float: left; width: 100%; margin-bottom: 0.6rem; }
.options-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; clear: both;
}
.option-chip { cursor: pointer; }
.option-chip input {
    position: absolute; opacity: 0; width: 1px; height: 1px;
    margin: 0; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}
.chip-content {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.65rem 0.85rem; background: var(--bg-input);
    border: 1px solid var(--border); border-radius: var(--radius);
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
    user-select: none;
}
.chip-icon {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 7px;
    background: rgba(255,255,255,0.05); font-weight: 700;
    font-size: 0.85rem; color: var(--text-muted); flex-shrink: 0;
}
.chip-text { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); }
.option-chip input:checked + .chip-content {
    border-color: var(--border-active); background: var(--accent-soft);
    box-shadow: 0 0 0 1px var(--border-active);
}
.option-chip input:checked + .chip-content .chip-icon { background: var(--accent); color: #000; }
.option-chip input:checked + .chip-content .chip-text { color: var(--text); }
.option-chip input:focus-visible + .chip-content { outline: 2px solid var(--accent); outline-offset: 2px; }
.option-chip:hover .chip-content { border-color: rgba(255,255,255,0.15); }

/* Option rows */
.options-list { display: flex; flex-direction: column; gap: 0.5rem; clear: both; }
.option-row {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 1rem; background: var(--bg-input);
    border: 1px solid var(--border); border-radius: var(--radius);
    cursor: pointer; transition: border-color var(--transition), background var(--transition);
}
.option-row:hover { background: var(--bg-hover); }
.option-checkbox {
    width: 18px; height: 18px; accent-color: var(--accent);
    cursor: pointer; flex-shrink: 0;
}
.option-row-content { display: flex; flex-direction: column; }
.option-row-title { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.option-row-desc { font-size: 0.75rem; color: var(--text-dim); }

/* Buttons */
.action-buttons { display: flex; gap: 0.6rem; margin-top: 0.25rem; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    flex: 1; padding: 0.85rem 1.25rem; border-radius: var(--radius);
    font-size: 0.9rem; font-weight: 600; border: none; cursor: pointer;
    transition: all var(--transition);
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
    background: var(--accent); color: #000;
    box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); box-shadow: 0 6px 24px var(--accent-glow); }
.btn-outline {
    background: transparent; color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-outline:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); border-color: rgba(255,255,255,0.15); }

/* Strength meter */
.strength-meter-container { margin-bottom: 1.25rem; }
.strength-meter-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.strength-label { font-weight: 700; font-size: 0.95rem; transition: color var(--transition); }
.strength-score { font-size: 0.8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.strength-meter-track { height: 8px; background: var(--bg-input); border-radius: 999px; overflow: hidden; }
.strength-meter-fill { height: 100%; border-radius: 999px; transition: width 0.4s cubic-bezier(0.4,0,0.2,1), background-color var(--transition); min-width: 0; }
.strength-very-weak { color: var(--strength-very-weak); }
.strength-weak { color: var(--strength-weak); }
.strength-medium { color: var(--strength-medium); }
.strength-strong { color: var(--strength-strong); }
.strength-very-strong { color: var(--strength-very-strong); }
.strength-meter-fill.strength-very-weak { background: var(--strength-very-weak); }
.strength-meter-fill.strength-weak { background: var(--strength-weak); }
.strength-meter-fill.strength-medium { background: var(--strength-medium); }
.strength-meter-fill.strength-strong { background: var(--strength-strong); }
.strength-meter-fill.strength-very-strong { background: var(--strength-very-strong); }

/* Stats */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-bottom: 1.25rem; }
.stat-card {
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 0.85rem; text-align: center;
}
.stat-icon { display: block; margin: 0 auto 0.35rem; color: var(--accent); }
.stat-icon svg { width: 18px; height: 18px; }
.stat-label { display: block; font-size: 0.68rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.2rem; }
.stat-value { display: block; font-size: 1rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 0.7rem; font-weight: 500; color: var(--text-dim); }
.stat-value-sm { font-size: 0.85rem; }

/* Variety badges */
.variety-section { margin-bottom: 1.25rem; }
.variety-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.4rem; }
.variety-badge {
    padding: 0.35rem 0.75rem; background: var(--bg-input);
    border: 1px solid var(--border); border-radius: 8px;
    font-size: 0.78rem; font-weight: 600; font-family: var(--font-mono);
    color: var(--text-dim); transition: all var(--transition);
}
.variety-badge.active { background: var(--accent-soft); border-color: var(--border-active); color: var(--accent); }

/* Suggestions */
.suggestions-title { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.6rem; }
.suggestions-list { list-style: none; padding: 0; margin: 0; }
.suggestions-list li {
    position: relative; padding: 0.55rem 0 0.55rem 1.25rem;
    font-size: 0.85rem; color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.suggestions-list li:last-child { border-bottom: none; }
.suggestions-list li::before { content: '→'; position: absolute; left: 0; color: var(--accent); font-weight: 700; }

/* Toast */
.toast {
    position: fixed; bottom: 1.5rem; left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--bg-card); border: 1px solid var(--border-active);
    color: var(--text); padding: 0.85rem 1.1rem; border-radius: var(--radius);
    font-size: 0.85rem; font-weight: 500; line-height: 1.45;
    box-shadow: var(--shadow); box-sizing: border-box;
    opacity: 0; pointer-events: none; transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 1000;
    max-width: min(92vw, 360px);
    width: max-content;
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* Privacy */
.privacy-page { max-width: 680px; margin: 0 auto; }
.privacy-title { font-size: 1.75rem; font-weight: 800; margin-bottom: 0.4rem; }
.privacy-updated { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 1.5rem; }
.privacy-content h2 { font-size: 1.1rem; font-weight: 700; margin: 1.25rem 0 0.5rem; }
.privacy-content p, .privacy-content li { color: var(--text-muted); line-height: 1.7; }
.privacy-content code { background: var(--bg-input); padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.85em; color: var(--accent); }

/* Animations */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes flash { 0%, 100% { box-shadow: none; } 50% { box-shadow: inset 0 0 0 2px var(--accent-glow); } }

/* Responsive */
@media (max-width: 991px) { .app-grid { grid-template-columns: 1fr; } }
@media (max-width: 575px) {
    .main-content { padding: 1.25rem 0 2rem; }
    .card-body { padding: 1rem; }
    .options-grid { grid-template-columns: 1fr; }
    .action-buttons { flex-direction: column; }
    .icon-btn span { display: none; }
    .password-input { font-size: 0.85rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
    html { scroll-behavior: auto; }
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:focus:not(:focus-visible) { outline: none; }

/* Toolistify visual integration */
:root {
    --bg: #f7fbff;
    --bg-card: #ffffff;
    --bg-input: #f7fafc;
    --bg-hover: #edf8ff;
    --border: rgba(0, 164, 255, 0.16);
    --border-active: rgba(0, 164, 255, 0.5);
    --text: #172033;
    --text-muted: #667085;
    --text-dim: #8290a3;
    --accent: #00a4ff;
    --accent-hover: #008bd8;
    --accent-glow: rgba(0, 164, 255, 0.2);
    --accent-soft: rgba(0, 164, 255, 0.1);
    --radius-lg: 24px;
    --shadow: 0 8px 28px rgba(0, 164, 255, 0.1);
}

body {
    background:
        radial-gradient(ellipse 70% 50% at 20% -10%, rgba(0, 164, 255, 0.12), transparent),
        radial-gradient(ellipse 50% 40% at 90% 110%, rgba(199, 244, 8, 0.1), transparent),
        #f7fbff;
}

.password-app {
    width: min(1140px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2rem 0 3rem;
}

.hero-title {
    background: linear-gradient(135deg, #172033 30%, #00a4ff);
    -webkit-background-clip: text;
    background-clip: text;
}

.card {
    border-radius: 24px;
}

.card-header {
    background: #f8fcff;
}

.btn-primary,
.btn-strengthen {
    color: #fff;
    background: linear-gradient(135deg, #00a4ff, #28b5ff);
}

.btn-primary:hover:not(:disabled),
.btn-strengthen:hover:not(:disabled) {
    color: #fff;
    background: linear-gradient(135deg, #008bd8, #00a4ff);
}

.option-chip input:checked + .chip-content .chip-icon {
    color: #fff;
}

@media (max-width: 575px) {
    .password-app {
        width: min(100% - 1.25rem, 1140px);
        padding-top: 1.25rem;
    }
}

body.toolistfy-embed .tool-header {
    display: none;
}

body.toolistfy-embed .password-app {
    padding-top: 1rem;
}
