/* ── Animated gradient background ────────────────────────────────────────── */

@keyframes gradientShift {
    0%   { background-position: 0%   50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0%   50%; }
}

html, body {
    min-height: 100vh;
}

body {
    background: linear-gradient(-45deg,
        #0a0a0a,
        #180608,
        #1c1c1c,
        #250c0c,
        #0e0e0e,
        #1a0707,
        #141414
    );
    background-size: 400% 400%;
    animation: gradientShift 40s ease infinite;
    color: #e8ddd8;
}

/* ── Page shell ──────────────────────────────────────────────────────────── */

.page-shell {
    position: relative;
    min-height: 100vh;
}

/* ── Language switcher ───────────────────────────────────────────────────── */

.lang-switcher {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    z-index: 10;
}

.lang-switcher a {
    color: #a08080;
    text-decoration: none;
    transition: color 0.2s;
}

.lang-switcher a:hover {
    color: #e0b0b0;
}

.lang-switcher a.active {
    color: #e0c0c0;
    font-weight: 600;
}

.lang-switcher .separator {
    color: #503030;
    margin: 0 0.3rem;
}

/* ── Glass card (main content panel) ────────────────────────────────────── */

.glass-card {
    background: rgba(12, 4, 4, 0.58);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(110, 25, 25, 0.22);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    margin-top: 2rem;
}

/* ── App title — gradient shimmer ────────────────────────────────────────── */

.app-title {
    background: linear-gradient(120deg, #e8cccc 0%, #c04040 45%, #e8cccc 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleShimmer 10s linear infinite;
    font-weight: 700;
}

@keyframes titleShimmer {
    0%   { background-position: 200% center; }
    100% { background-position:   0% center; }
}

/* ── Textarea ────────────────────────────────────────────────────────────── */

.text-input {
    background: rgba(15, 5, 5, 0.65) !important;
    border-color: rgba(100, 28, 28, 0.5) !important;
    color: #f0e8e8 !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.text-input:focus {
    background: rgba(20, 7, 7, 0.75) !important;
    border-color: rgba(160, 40, 40, 0.8) !important;
    box-shadow: 0 0 0 0.2rem rgba(130, 30, 30, 0.3) !important;
    color: #f8f0f0 !important;
}

.text-input::placeholder {
    color: #806060 !important;
}

/* ── Word highlight spans ────────────────────────────────────────────────── */

.word-filtered {
    background-color: rgba(220, 53, 69, 0.22);
    color: #ff7f7f !important;        /* !important overrides parent color-tag inline style */
    border-radius: 2px;
    padding: 0 2px;
    cursor: help;
    text-decoration: underline dotted rgba(220, 53, 69, 0.6);
}

.word-autofixed {
    background-color: rgba(255, 193, 7, 0.18);
    color: #ffd966 !important;        /* !important overrides parent color-tag inline style */
    border-radius: 2px;
    padding: 0 2px;
    cursor: help;
    text-decoration: underline dotted rgba(255, 193, 7, 0.5);
}

/* ── Color tag syntax delimiters (dim, selectable) ───────────────────────── */

.color-tag-syntax {
    opacity: 0.38;
    font-size: 0.82em;
    user-select: text;
}

/* ── Char counter badge ──────────────────────────────────────────────────── */

.char-counter {
    min-width: 4rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-size: 0.72rem;
}

.char-counter.ok {
    background-color: #1a6b3a;
    color: #c8f0d8;
}

.char-counter.warn {
    background-color: #7b1a1a;
    color: #ffd0d0;
}

/* ── Line content area ───────────────────────────────────────────────────── */

.text-line-content {
    background: rgba(18, 6, 6, 0.55) !important;
    border-color: rgba(80, 18, 18, 0.35) !important;
    color: #f0e4e4 !important;
    line-height: 1.6;
    min-height: 2rem;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ── Mode buttons — wine-red active accent ───────────────────────────────── */

.btn-check:checked + .btn-outline-danger {
    background-color: #6b1515;
    border-color:     #6b1515;
    color:            #ffd0d0;
}

/* ── Code tags in leet legend ────────────────────────────────────────────── */

code {
    background: rgba(120, 30, 30, 0.25);
    color: #ffb0b0;
    border-radius: 3px;
    padding: 0 4px;
    font-size: 0.82em;
}

/* ── Copy button ─────────────────────────────────────────────────────────── */

.btn-copy {
    font-size: 0.78rem;
    white-space: nowrap;
}

/* ── Color tag buttons ───────────────────────────────────────────────────── */

.btn-color-tag {
    color: var(--tc);
    border: 1px solid color-mix(in srgb, var(--tc) 45%, transparent);
    font-size: 0.72rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background: color-mix(in srgb, var(--tc) 10%, transparent);
    transition: background 0.15s, border-color 0.15s;
    cursor: pointer;
    line-height: 1.4;
}

.btn-color-tag:hover {
    background: color-mix(in srgb, var(--tc) 25%, transparent);
    border-color: var(--tc);
}

/* ── Star (favorite) button ──────────────────────────────────────────────── */

.btn-star {
    background: transparent;
    border: none;
    font-size: 1.05rem;
    line-height: 1;
    padding: 0.15rem 0.3rem;
    color: rgba(255, 215, 0, 0.25);
    cursor: pointer;
    transition: color 0.15s;
}

.btn-star:hover {
    color: rgba(255, 215, 0, 0.7);
}

.btn-star.starred {
    color: #ffd700;
}

/* ── Output / Favorites tab bar ──────────────────────────────────────────── */

#outputTabs {
    border-bottom: 1px solid rgba(100, 28, 28, 0.45);
}

#outputTabs .nav-link {
    color: #a08080;
    font-size: 0.82rem;
    border-color: transparent;
    border-radius: 0.375rem 0.375rem 0 0;
}

#outputTabs .nav-link:hover {
    color: #e0b0b0;
    border-color: rgba(100, 28, 28, 0.25) rgba(100, 28, 28, 0.25) transparent;
}

#outputTabs .nav-link.active {
    background: rgba(12, 4, 4, 0.6);
    border-color: rgba(100, 28, 28, 0.45) rgba(100, 28, 28, 0.45) transparent;
    color: #e8cccc;
}

/* ── Theme: Dark Purple ───────────────────────────────────────────────────── */

html.theme-purple body {
    background: linear-gradient(-45deg,
        #0a0a0a,
        #0d0718,
        #1c1c1c,
        #160c2a,
        #0e0e0e,
        #0b0718,
        #141414
    );
    background-size: 400% 400%;
    animation: gradientShift 40s ease infinite;
}

html.theme-purple .glass-card {
    background: rgba(6, 4, 14, 0.58);
    border-color: rgba(90, 25, 130, 0.28);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html.theme-purple .app-title {
    background: linear-gradient(120deg, #dcc8f0 0%, #9040d0 45%, #dcc8f0 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

html.theme-purple .lang-switcher a        { color: #9080b0; }
html.theme-purple .lang-switcher a:hover  { color: #ccb0e8; }
html.theme-purple .lang-switcher a.active { color: #d0bce8; }
html.theme-purple .lang-switcher .separator { color: #3a2060; }

html.theme-purple .text-input {
    background: rgba(8, 4, 16, 0.65) !important;
    border-color: rgba(90, 28, 140, 0.5) !important;
    color: #f0e8f8 !important;
}

html.theme-purple .text-input:focus {
    background: rgba(12, 6, 22, 0.75) !important;
    border-color: rgba(140, 40, 200, 0.8) !important;
    box-shadow: 0 0 0 0.2rem rgba(110, 30, 170, 0.3) !important;
    color: #f8f0ff !important;
}

html.theme-purple .text-input::placeholder { color: #7060a0 !important; }

html.theme-purple .text-line-content {
    background: rgba(10, 5, 20, 0.55) !important;
    border-color: rgba(60, 18, 100, 0.35) !important;
    color: #f0e4ff !important;
}

html.theme-purple .btn-check:checked + .btn-outline-danger {
    background-color: #4a1570;
    border-color:     #4a1570;
    color:            #e8d0ff;
}

html.theme-purple code {
    background: rgba(100, 30, 160, 0.25);
    color: #d8b0ff;
}

html.theme-purple #outputTabs {
    border-bottom-color: rgba(90, 28, 140, 0.45);
}

html.theme-purple #outputTabs .nav-link       { color: #9080b0; }
html.theme-purple #outputTabs .nav-link:hover {
    color: #ccb0e8;
    border-color: rgba(90, 28, 140, 0.25) rgba(90, 28, 140, 0.25) transparent;
}
html.theme-purple #outputTabs .nav-link.active {
    background: rgba(8, 4, 16, 0.6);
    border-color: rgba(90, 28, 140, 0.45) rgba(90, 28, 140, 0.45) transparent;
    color: #dcc8f0;
}

/* ── Theme: Dark Red + Dark Purple (dual) ────────────────────────────────── */

html.theme-dual body {
    background: linear-gradient(-45deg,
        #180608,
        #0d0718,
        #250c0c,
        #160c2a,
        #1a0707,
        #0b0718,
        #141414
    );
    background-size: 400% 400%;
    animation: gradientShift 40s ease infinite;
}

html.theme-dual .glass-card {
    background: rgba(9, 4, 14, 0.58);
    border-color: rgba(100, 25, 110, 0.25);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html.theme-dual .app-title {
    background: linear-gradient(120deg, #e8cccc 0%, #c04040 30%, #9040d0 70%, #dcc8f0 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

html.theme-dual .lang-switcher a        { color: #a07898; }
html.theme-dual .lang-switcher a:hover  { color: #d8b8d8; }
html.theme-dual .lang-switcher a.active { color: #e0c8e0; }
html.theme-dual .lang-switcher .separator { color: #482848; }

html.theme-dual .text-input {
    background: rgba(12, 4, 14, 0.65) !important;
    border-color: rgba(110, 28, 120, 0.5) !important;
    color: #f4e8f4 !important;
}

html.theme-dual .text-input:focus {
    background: rgba(16, 6, 20, 0.75) !important;
    border-color: rgba(160, 40, 160, 0.8) !important;
    box-shadow: 0 0 0 0.2rem rgba(130, 30, 140, 0.3) !important;
    color: #faf0ff !important;
}

html.theme-dual .text-input::placeholder { color: #785878 !important; }

html.theme-dual .text-line-content {
    background: rgba(12, 5, 14, 0.55) !important;
    border-color: rgba(70, 18, 80, 0.35) !important;
    color: #f0e4f4 !important;
}

html.theme-dual .btn-check:checked + .btn-outline-danger {
    background-color: #5c1560;
    border-color:     #5c1560;
    color:            #f0d0f8;
}

html.theme-dual code {
    background: rgba(110, 30, 120, 0.25);
    color: #f0b0f8;
}

html.theme-dual #outputTabs {
    border-bottom-color: rgba(110, 28, 120, 0.45);
}

html.theme-dual #outputTabs .nav-link       { color: #a07898; }
html.theme-dual #outputTabs .nav-link:hover {
    color: #d8b8d8;
    border-color: rgba(110, 28, 120, 0.25) rgba(110, 28, 120, 0.25) transparent;
}
html.theme-dual #outputTabs .nav-link.active {
    background: rgba(10, 4, 14, 0.6);
    border-color: rgba(110, 28, 120, 0.45) rgba(110, 28, 120, 0.45) transparent;
    color: #e8d0f0;
}

/* ── Theme picker (floating, bottom-right) ───────────────────────────────── */

.theme-opts-hidden {
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.theme-opts-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Option buttons */

.theme-opt-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s ease;
}

.theme-opt-btn:hover { transform: scale(1.12); }

.theme-opt-btn.theme-opt-active {
    outline: 2px solid rgba(255, 255, 255, 0.85);
    outline-offset: 2px;
}

.theme-opt-red {
    background: radial-gradient(circle at 40% 40%, #6b1515, #1a0707);
}

.theme-opt-purple {
    background: radial-gradient(circle at 40% 40%, #4a1570, #0b0718);
}

.theme-opt-dual {
    background: linear-gradient(135deg, #6b1515 50%, #4a1570 50%);
}

/* Main toggle button */

.theme-toggle-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    background: rgba(20, 10, 20, 0.75);
    backdrop-filter: blur(6px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, transform 0.15s;
}

.theme-toggle-btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.08);
}

/* Dot inside main button — reflects active theme */

.theme-icon-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: block;
}

.theme-icon-dot-red {
    background: radial-gradient(circle at 40% 40%, #c04040, #6b1515);
}

.theme-icon-dot-purple {
    background: radial-gradient(circle at 40% 40%, #9040d0, #4a1570);
}

.theme-icon-dot-dual {
    background: linear-gradient(135deg, #c04040 50%, #9040d0 50%);
}
