/* assets/css/style.css */

:root {
    /* Premium Dark Theme */
    --bg-color: #323437;
    /* Deep Charcoal */
    --main-color: #e2b714;
    /* Vibrant Gold */
    --text-color: #646669;
    /* Muted Grey */
    --text-active: #d1d0c5;
    /* Off-White */
    --caret-color: #e2b714;
    --error-color: #ca4754;
    /* Red */
    --correct-color: #d1d0c5;
    --sub-color: #2c2e31;
    /* Darker Sub-background */

    /* Transitions */
    --transition-speed: 0.2s;
}

[data-theme="light"] {
    --bg-color: #f0f0f0;
    --main-color: #007bff;
    --text-color: #999;
    --text-active: #444;
    --caret-color: #007bff;
    --error-color: #f44336;
    --correct-color: #222;
    --sub-color: #fff;
}

body {
    background-color: var(--bg-color);
    color: var(--text-active);
    font-family: 'Inter', 'Hind Siliguri', sans-serif;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
    margin: 0;
    line-height: 1.6;
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.text-center {
    text-align: center;
}

.flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.items-center {
    align-items: center;
}

.grid {
    display: grid;
}

.gap-6 {
    gap: 1.5rem;
}

/* Typography */
h1,
h2,
h3 {
    color: var(--text-active);
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-speed);
}

/* Typing Area */
#typing-area {
    font-size: 1.7rem;
    /* Slightly larger for focus */
    line-height: 1.6;
    min-height: 150px;
    color: var(--text-color);
    position: relative;
    outline: none;
    cursor: text;
    transition: opacity var(--transition-speed);
}

.char {
    position: relative;
    transition: color 0.1s ease-in-out;
    /* Smooth color transition */
    border-bottom: 2px solid transparent;
    /* Prepare for underline */
}

.char.correct {
    color: var(--correct-color);
}

.char.incorrect {
    color: var(--error-color);
    text-decoration: underline;
    /* Fallback */
    border-bottom-color: var(--error-color);
    /* Cleaner underline */
}

/* Caret Animation */
.active-caret::before {
    content: '';
    position: absolute;
    left: -2px;
    /* Adjust position */
    top: 10%;
    height: 80%;
    width: 2px;
    /* Thin, elegant cursor */
    background-color: var(--caret-color);
    animation: blink 1s infinite;
    box-shadow: 0 0 5px var(--caret-color);
    /* Subtle glow */
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* System Cards */
.system-card {
    background: var(--sub-color);
    padding: 2rem;
    border-radius: 1rem;
    border: 2px solid transparent;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.system-card:hover {
    transform: translateY(-5px);
    border-color: var(--main-color);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2);
}

.system-card .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    transition: transform 0.2s;
}

.system-card:hover .icon {
    transform: scale(1.1);
}

.system-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.system-card p {
    color: var(--text-color);
    font-size: 0.9rem;
    margin: 0;
}

.system-card .tag {
    display: inline-block;
    margin-top: 1rem;
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--main-color);
    background: rgba(226, 183, 20, 0.1);
    /* Subtle badge bg */
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

/* Navigation */
nav {
    border-bottom: 1px solid var(--sub-color);
    padding: 1rem 2rem;
    backdrop-filter: blur(10px);
}

nav .logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--main-color);
    letter-spacing: -0.5px;
}

nav button,
select {
    background: var(--sub-color);
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    color: var(--text-active);
    border-radius: 0.5rem;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-speed);
}

nav button:hover,
select:hover {
    background: #3c3e42;
    border-color: var(--text-color);
}

/* Dashboard Chart */
.dashboard-container {
    background: var(--sub-color);
    padding: 2rem;
    border-radius: 1rem;
    margin-top: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Hidden Input for Mobile/Focus */
#input-field {
    opacity: 0;
    position: absolute;
    z-index: -1;
}

/* Responsive */
@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
    }

    nav {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Racing Arena (TypeRush) Styles */
.racing-track {
    width: 100%;
    background: #2c2e31;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 2rem;
    position: relative;
    border: 1px solid #444;
}

.car-lane {
    height: 40px;
    width: 100%;
    position: relative;
    border-bottom: 2px dashed #444;
    display: flex;
    align-items: center;
}

.car-icon {
    position: absolute;
    left: 0;
    font-size: 2rem;
    transition: left 0.3s ease;
    z-index: 10;
}

.finish-line {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    opacity: 0.5;
}

/* Responsive Racing */
@media (max-width: 768px) {
    .racing-track {
        padding: 10px;
    }

    .car-icon {
        font-size: 1.5rem;
    }
}