@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --bg: #09090b;
    --bg-elevated: #18181b;
    --bg-surface: #1c1c21;
    --bg-input: #0f0f12;
    --border: #27272a;
    --border-hover: #3f3f46;
    --ring: #6366f1;
    --ring-glow: rgba(99,102,241,.15);

    --primary: #6366f1;
    --primary-hover: #818cf8;
    --secondary: #a78bfa;
    --accent: #22d3ee;
    --success: #22c55e;
    --warning: #eab308;
    --danger: #ef4444;

    --text: #fafafa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --text-inverse: #09090b;

    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --mono: 'JetBrains Mono', 'Consolas', monospace;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: .2s ease;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── HEADER ── */
.header {
    background: rgba(9,9,11,.8);
    backdrop-filter: blur(20px) saturate(1.2);
    border-bottom: 1px solid var(--border);
    padding: 0 40px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-icon {
    width: 28px; height: 28px;
    background: var(--primary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-icon svg { width: 16px; height: 16px; }

.menu { display: flex; gap: 4px; }

.menu a {
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 6px;
    transition: var(--transition);
}

.menu a:hover { color: var(--text); background: var(--bg-elevated); }

.menu a.active {
    color: var(--text);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}

/* ── LAYOUT ── */
.main-content {
    flex: 1;
    padding: 48px 24px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.container {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    margin: 0 auto 32px;
    max-width: 780px;
    width: 100%;
}

/* ── TYPOGRAPHY ── */
h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -.5px;
    color: var(--text);
    margin-bottom: 4px;
}

.subtitle {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-bottom: 32px;
    line-height: 1.5;
}

h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: .5px;
}

h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-transform: uppercase;
    letter-spacing: .3px;
}

/* ── TABS ── */
.nav-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 28px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.nav-tabs button {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition);
}

.nav-tabs button.active {
    background: var(--primary);
    color: #fff;
}

.nav-tabs button:hover:not(.active) {
    color: var(--text);
    background: rgba(255,255,255,.04);
}

/* ── FORMS ── */
.form-group { margin-bottom: 20px; }

textarea, input[type="text"], input[type="password"], input[type="number"], select, .textbox {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--text);
    font-size: 14px;
    font-family: var(--mono);
    transition: var(--transition);
    resize: vertical;
}

textarea:focus, input:focus, select:focus, .textbox:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--ring-glow);
}

textarea::placeholder, input::placeholder { color: var(--text-tertiary); }

textarea[readonly] {
    background: rgba(15,15,18,.6);
    color: var(--accent);
    cursor: default;
}

/* ── BUTTONS ── */
.btn-primary, .btn-secondary, .btn-clear, .btn-copy {
    font-family: var(--font);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    padding: 10px 22px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--ring-glow);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    padding: 10px 22px;
    font-size: 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border) !important;
}

.btn-secondary:hover {
    border-color: var(--border-hover) !important;
    background: var(--bg-surface);
    transform: translateY(-1px);
}

.btn-clear {
    background: transparent;
    color: var(--danger);
    padding: 10px 22px;
    font-size: 13px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(239,68,68,.2) !important;
}

.btn-clear:hover {
    background: var(--danger);
    color: #fff;
    transform: translateY(-1px);
}

.btn-copy {
    background: rgba(99,102,241,.1);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
}

.btn-copy:hover {
    background: var(--primary);
    color: #fff;
}

/* ── CONTROL ROW ── */
.between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin: 24px 0;
    padding: 16px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.between label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

input[type="number"] { width: 80px; padding: 8px; text-align: center; }

/* ── INFO BOX ── */
.info, .requirements {
    background: var(--bg);
    padding: 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    margin-top: 28px;
}

.info h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.info p { color: var(--text-tertiary); font-size: 13px; margin-bottom: 4px; line-height: 1.6; }
.info p b { color: var(--text-secondary); }

/* ── PASSWORD STRENGTH ── */
.strength-meter {
    height: 4px;
    background: var(--bg);
    border-radius: 2px;
    margin: 12px 0;
    overflow: hidden;
}

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

.strength-text { font-size: 13px; font-weight: 600; margin-bottom: 12px; }

.bar-weak { background: var(--danger); }
.bar-fair { background: var(--warning); }
.bar-good { background: #a3e635; }
.bar-strong { background: var(--success); }

.strength-weak { color: var(--danger); }
.strength-fair { color: var(--warning); }
.strength-good { color: #a3e635; }
.strength-strong { color: var(--success); }

.toggle-password {
    position: absolute;
    right: 14px;
    top: 42px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(99,102,241,.08);
    user-select: none;
}

.toggle-password:hover { background: var(--primary); color: #fff; }

.requirement {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-tertiary);
    margin: 8px 0;
}

.requirement.met { color: var(--success); }
.requirement::before { content: "×"; color: var(--danger); font-weight: 700; font-size: 14px; width: 16px; text-align: center; }
.requirement.met::before { content: "✓"; color: var(--success); }

/* ── GENERATOR SETTINGS ── */
.generator-setting { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }

.slider-container {
    grid-column: span 2;
    background: var(--bg);
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.slider-header { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; font-weight: 600; }

input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
    height: 4px;
    outline: none;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
}

.checkbox-container:hover { border-color: var(--border-hover); }
.checkbox-container input { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }

/* ── DROP ZONE ── */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 20px;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(99,102,241,.03);
}

.drop-zone-icon { font-size: 24px; margin-bottom: 8px; display: block; color: var(--text-tertiary); }
.drop-zone-text { font-size: 14px; color: var(--text-tertiary); }
.drop-zone-text b { color: var(--primary); }

/* ── HOMEPAGE HERO ── */
.hero {
    text-align: center;
    padding: 80px 0 60px;
    max-width: 700px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 48px;
    font-weight: 900;
    letter-spacing: -1.5px;
    line-height: 1.1;
    margin-bottom: 16px;
}

.hero h1 .gradient {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 16px;
    color: var(--text-tertiary);
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ── TOOL GRID ── */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    padding: 0 0 60px;
}

.tool-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    text-decoration: none;
    color: var(--text);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tool-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,.3);
}

.tool-card-icon {
    width: 40px; height: 40px;
    background: rgba(99,102,241,.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-card-icon svg { width: 20px; height: 20px; stroke: var(--primary); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.tool-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    text-transform: none;
    letter-spacing: -.2px;
    margin: 0;
}

.tool-card p { font-size: 13px; color: var(--text-tertiary); line-height: 1.5; margin: 0; }

.tool-card .arrow {
    margin-top: auto;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── STATS BAR ── */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 48px;
}

.stat-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
}

.stat-value { font-size: 28px; font-weight: 800; color: var(--text); letter-spacing: -1px; }
.stat-label { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; font-weight: 500; }

/* ── HISTORY ── */
.history-section { padding: 48px 0 0; border-top: 1px solid var(--border); }

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

.history-header h2 { margin: 0; border: none; padding: 0; }

.history-list {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.history-item:last-child { border-bottom: none; }
.history-item:hover { background: rgba(255,255,255,.02); }

.history-badge {
    background: rgba(99,102,241,.1);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.history-text {
    flex: 1;
    margin: 0 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
    font-family: var(--mono);
    font-size: 12px;
}

.history-time { color: var(--text-tertiary); font-size: 11px; white-space: nowrap; }

.history-empty { padding: 32px; text-align: center; color: var(--text-tertiary); font-size: 13px; }

/* ── STEGO ── */
.stego-comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }

.stego-image-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
}

.stego-preview {
    max-width: 100%;
    max-height: 220px;
    border-radius: 4px;
    margin-top: 10px;
    background: var(--bg-input);
}

/* ── TOAST ── */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-left: 3px solid var(--success);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 30px rgba(0,0,0,.4);
    color: var(--text);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 240px;
    transform: translateY(80px);
    opacity: 0;
    animation: toastIn .25s ease forwards;
}

.toast.toast-error { border-left-color: var(--danger); }

@keyframes toastIn { to { transform: translateY(0); opacity: 1; } }

/* ── FOOTER ── */
.footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 12px;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ── AUDIO TOGGLE ── */
.audio-toggle-container {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.audio-toggle-container input { accent-color: var(--primary); cursor: pointer; }

/* ── SCROLL-REVEAL ANIMATION SYSTEM ── */
/* Elements start invisible and slide up when they enter the viewport */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity .7s cubic-bezier(.16,1,.3,1), transform .7s cubic-bezier(.16,1,.3,1);
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered delays for grid children */
.reveal-stagger > * {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity .6s cubic-bezier(.16,1,.3,1), transform .6s cubic-bezier(.16,1,.3,1);
}

.reveal-stagger.revealed > * { opacity: 1; transform: translateY(0); }
.reveal-stagger.revealed > *:nth-child(1) { transition-delay: .05s; }
.reveal-stagger.revealed > *:nth-child(2) { transition-delay: .1s; }
.reveal-stagger.revealed > *:nth-child(3) { transition-delay: .15s; }
.reveal-stagger.revealed > *:nth-child(4) { transition-delay: .2s; }
.reveal-stagger.revealed > *:nth-child(5) { transition-delay: .25s; }
.reveal-stagger.revealed > *:nth-child(6) { transition-delay: .3s; }
.reveal-stagger.revealed > *:nth-child(7) { transition-delay: .35s; }

/* Page-load fade for hero */
.hero {
    animation: heroIn .9s cubic-bezier(.16,1,.3,1) forwards;
}

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

/* Tool card refined hover — arrow slides right */
.tool-card {
    transition: transform .35s cubic-bezier(.16,1,.3,1), border-color .35s ease, box-shadow .35s ease;
}

.tool-card .arrow {
    transition: gap .3s cubic-bezier(.16,1,.3,1), color .2s ease;
}

.tool-card:hover .arrow {
    gap: 10px;
    color: var(--primary-hover);
}

/* Tool card icon subtle scale on card hover */
.tool-card-icon {
    transition: transform .35s cubic-bezier(.16,1,.3,1), background .35s ease;
}

.tool-card:hover .tool-card-icon {
    transform: scale(1.1);
}

/* Stat items — count-up entrance */
.stat-item {
    transition: transform .35s cubic-bezier(.16,1,.3,1), box-shadow .35s ease;
}

.stat-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,.25);
}

/* Container entrance */
.container {
    animation: containerIn .6s cubic-bezier(.16,1,.3,1) forwards;
}

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

/* Smooth nav link underline effect */
.menu a {
    position: relative;
    transition: color .2s ease, background .2s ease;
}

.menu a::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    width: 0;
    height: 1.5px;
    background: var(--primary);
    transition: width .3s cubic-bezier(.16,1,.3,1), left .3s cubic-bezier(.16,1,.3,1);
}

.menu a:hover::after {
    width: 60%;
    left: 20%;
}

.menu a.active::after {
    display: none;
}

/* Button press effect */
.btn-primary:active, .btn-secondary:active, .btn-clear:active {
    transform: translateY(0) scale(.97);
    transition: transform .1s ease;
}

/* Drop zone pulse on dragover */
.drop-zone.dragover {
    animation: dropPulse 1s ease infinite;
}

@keyframes dropPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,.15); }
    50% { box-shadow: 0 0 0 8px rgba(99,102,241,0); }
}

/* Tab switch smooth background slide */
.nav-tabs button {
    transition: background .25s cubic-bezier(.16,1,.3,1), color .2s ease;
}

/* Header slide-down on page load */
.header {
    animation: headerIn .5s cubic-bezier(.16,1,.3,1) forwards;
}

@keyframes headerIn {
    from { opacity: 0; transform: translateY(-100%); }
    to { opacity: 1; transform: translateY(0); }
}

/* Footer fade in */
.footer {
    animation: footerIn .6s .3s cubic-bezier(.16,1,.3,1) both;
}

@keyframes footerIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Info box subtle left-border grow */
.info {
    border-left-width: 0;
    animation: infoIn .5s .2s ease forwards;
}

@keyframes infoIn {
    to { border-left-width: 3px; }
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    .header { padding: 0 16px; flex-wrap: wrap; height: auto; padding: 12px 16px; gap: 8px; }
    .menu { flex-wrap: wrap; justify-content: center; }
    .hero h1 { font-size: 32px; }
    .tools-grid { grid-template-columns: 1fr; }
    .stats-bar { grid-template-columns: 1fr 1fr; }
    .container { padding: 24px 16px; }
    .between { flex-direction: column; align-items: stretch; }
    .stego-comparison { grid-template-columns: 1fr; }
    .generator-setting { grid-template-columns: 1fr; }
    .slider-container { grid-column: span 1; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
    .reveal { opacity: 1; transform: none; }
    .reveal-stagger > * { opacity: 1; transform: none; }
}
