/* =========================
   ROOT VARIABLES
========================= */
:root {
    --bg-main: #0b1220;
    --bg-card: rgba(15, 23, 42, 0.92);
    --bg-soft: rgba(30, 41, 59, 0.9);

    --primary: #22c55e;
    --primary-glow: rgba(34,197,94,0.45);
    --secondary: #38bdf8;

    --text-main: #e5fbe5;
    --text-muted: #9ca3af;
    --border-soft: rgba(148,163,184,0.18);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
}

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

html, body {
    height: 100%;
}

/* =========================
   BODY
========================= */
body {
    font-family: "Inter", "Segoe UI", Tahoma, Arial, sans-serif;
    background:
        radial-gradient(circle at top, #1e293b 0%, #020617 70%);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

/* =========================
   SUBTLE MATRIX EFFECT
========================= */
.matrix-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
        to bottom,
        rgba(34,197,94,0.08) 0,
        transparent 60%
    );
    background-size: 100% 60px;
    animation: matrix-fall 2.5s linear infinite;
    opacity: 0.25;
}

@keyframes matrix-fall {
    from { background-position-y: 0; }
    to   { background-position-y: 60px; }
}

/* =========================
   MAIN CONTAINER
========================= */
.grid-background {
    width: 100%;
    max-width: 960px;
    padding: 2px;
    border-radius: var(--radius-lg);
    background: linear-gradient(
        120deg,
        rgba(34,197,94,0.6),
        rgba(56,189,248,0.35),
        rgba(34,197,94,0.6)
    );
}

.converter-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow:
        0 30px 80px rgba(0,0,0,0.6),
        inset 0 0 0 1px var(--border-soft);
}

/* =========================
   HEADER BAR
========================= */
.win-titlebar {
    padding: 14px 18px;
    background: linear-gradient(180deg, #020617, #020617cc);
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.win-title {
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 13px;
}

.win-controls {
    display: flex;
    gap: 8px;
}

.win-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
}

.win-btn.close { background: #ef4444; }
.win-btn.min   { background: #facc15; }
.win-btn.max   { background: #22c55e; }

/* =========================
   MODE TOGGLE
========================= */
.mode-toggle {
    display: flex;
    gap: 10px;
    margin: 18px;
}

.mode-tab {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.25s ease;
}

.mode-tab.active {
    color: var(--text-main);
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-glow);
}

/* =========================
   TEXT INPUT
========================= */
#aiInput {
    width: calc(100% - 36px);
    margin: 0 18px;
    min-height: 170px;
    padding: 16px;
    border-radius: var(--radius-md);
    background: #020617;
    border: 1px solid var(--border-soft);
    color: var(--text-main);
    font-size: 15px;
    line-height: 1.6;
}

#aiInput:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

/* =========================
   BUTTONS
========================= */
.controls {
    display: flex;
    gap: 12px;
    margin: 16px 18px;
    flex-wrap: wrap;
}

button {
    padding: 12px 18px;
    border-radius: var(--radius-md);
    background: linear-gradient(120deg, var(--primary), #16a34a);
    color: #02130a;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 28px var(--primary-glow);
}

.secondary {
    background: var(--bg-soft);
    color: var(--text-main);
    border: 1px solid var(--border-soft);
}

/* =========================
   OUTPUT
========================= */
.output-container {
    margin: 0 18px 18px;
    padding: 16px;
    min-height: 200px;
    max-height: 420px;
    overflow-y: auto;
    background: #020617;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
}

.output-text {
    font-size: 15px;
    line-height: 1.7;
    white-space: pre-wrap;
}

/* =========================
   STATS
========================= */
.stats {
    display: flex;
    justify-content: space-between;
    padding: 14px 18px;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-soft);
}

/* =========================
   SCAN OVERLAY
========================= */
.scan-overlay {
    position: absolute;
    inset: 0;
    backdrop-filter: blur(6px);
    background: rgba(2,6,23,0.85);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 18px;
    z-index: 5;
}

.scan-overlay.active {
    display: flex;
}

.scan-line {
    width: 100%;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--primary),
        transparent
    );
    animation: scan-move 1.3s linear infinite;
}

@keyframes scan-move {
    from { transform: translateY(-120px); opacity: 0; }
    30%  { opacity: 1; }
    to   { transform: translateY(120px); opacity: 0; }
}

/* =========================
   STATUS COLORS
========================= */
.success { color: #22c55e; }
.error   { color: #ef4444; }
.loading { opacity: 0.6; pointer-events: none; }
