/* Global Styles */
:root {
    --bg: #141a20;
    --card-bg: rgba(16, 24, 36, 0.92);
    --surface-bg: rgba(10, 16, 26, 0.72);
    --text: #e6edf3;
    --muted: #9aa0a6;
    --accent: #3b82f6;
    --accent-strong: #2563eb;
    --border-color: rgba(103, 122, 147, 0.4);
    --shadow-color: rgba(0, 0, 0, 0.28);
}

.light-theme {
    --bg: #f0f2f5; /* A gentle, soft background */
    --card-bg: #ffffff;
    --surface-bg: #f8fafc;
    --text: #1f2328; /* Dark, readable text */
    --muted: #656d76;
    --accent: #0969da;
    --accent-strong: #0857b8;
    --border-color: #d0d7de;
    --shadow-color: rgba(15, 23, 42, 0.08);
}

/* Light-mode fixes */
.light-theme .card h1 { color: var(--text) !important; }
.light-theme .form-check-label { color: var(--text); }


body, html {
    height: 100%;
    margin: 0;
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.18), transparent 34%),
        radial-gradient(circle at top right, rgba(34, 197, 94, 0.12), transparent 28%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
    width: 100%;
    font-family: "Segoe UI", "Trebuchet MS", sans-serif;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 220ms ease, color 220ms ease;
}

/* Container */
.container {
    max-width: 1100px;
    margin: 40px auto;
}

/* Card adjustments */
.card.bg-dark {
    background-color: var(--card-bg) !important;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    box-shadow: 0 18px 48px var(--shadow-color);
    backdrop-filter: blur(14px);
    transition: background-color 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.card.bg-dark h1,
.card.bg-dark h5 {
    letter-spacing: 0.02em;
}

.card.bg-dark .form-check {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
}

/* Header image (logo) - responsive */
.header-img {
    max-width: 64px;
    height: auto;
    display: inline-block;
}

/* Legend container - mobile friendly scroll */
#legendContainer {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
}
#legendContainer button {
    white-space: nowrap;
    min-width: 88px;
    color: white; /* Legend buttons have colored backgrounds */
    border: none;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

/* Animations */
.fade-in { animation: fadeInUp 0.28s ease both; }
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Disable animations when user opts out */
.animations-disabled .fade-in,
.animations-disabled * {
    animation: none !important;
    transition: none !important;
}

/* Adjust textareas and buttons to respect theme variables */
textarea#textInput.form-control {
    background-color: var(--surface-bg);
    border: 1px solid var(--border-color);
    color: var(--text);
    min-height: 140px;
    resize: vertical;
    border-radius: 14px;
    transition: background-color 220ms ease, color 220ms ease, border-color 220ms ease;
}

.light-theme textarea#textInput.form-control {
    background-color: #f6f8fa; /* Slightly off-white for text area */
}

textarea#textInput.form-control::placeholder {
    color: var(--muted);
}

textarea#textInput.form-control:focus {
    background-color: var(--surface-bg);
    color: var(--text);
    border-color: var(--accent);
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.18);
}

.btn-primary {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #ffffff; /* White text on buttons */
    border-radius: 999px;
    padding: 0.6rem 1.1rem;
    font-weight: 600;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.28);
}
.btn-primary:hover {
    background-color: var(--accent-strong);
    border-color: var(--accent-strong);
    filter: none;
}

.btn-secondary,
.btn-info {
    border-radius: 999px;
    font-weight: 600;
}

.btn-secondary {
    background-color: rgba(148, 163, 184, 0.18);
    border-color: rgba(148, 163, 184, 0.32);
}

.btn-secondary:hover {
    background-color: rgba(148, 163, 184, 0.28);
    border-color: rgba(148, 163, 184, 0.42);
}

.btn-info {
    background-color: rgba(14, 165, 233, 0.18);
    border-color: rgba(56, 189, 248, 0.32);
    color: var(--text);
}

.btn-info:hover {
    background-color: rgba(14, 165, 233, 0.28);
    border-color: rgba(56, 189, 248, 0.44);
    color: var(--text);
}

/* Output Box */
.output {
    background-color: var(--surface-bg);
    padding: 12px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    min-height: 80px;
    text-align: left;
    word-wrap: break-word;
    color: var(--text);
    transition: background-color 220ms ease, border-color 220ms ease, color 220ms ease;
}

/* Word Highlighting */
.highlight {
    padding: 3px 6px;
    border-radius: 8px;
    font-weight: 600;
    margin-right: 4px;
    margin-bottom: 4px;
    display: inline-block;
    transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.no-box-mode .highlight {
    padding: 0;
    margin: 0;
    border-radius: 0;
    display: inline;
}

/* Responsive */
@media (max-width: 767px) {
    .container { margin: 20px; }
    .header-img { max-width: 40px; height: auto; display: inline-block; margin-right: 10px; }
    #legendContainer { padding: 8px 0; }
}
 
