:root {
    --bg-dark: #0f172a;
    --bg-surface: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;

    --primary-gradient: linear-gradient(135deg, #3b82f6, #2563eb);
    --primary-shadow: rgba(59, 130, 246, 0.4);

    --danger-gradient: linear-gradient(135deg, #ef4444, #dc2626);
    --danger-shadow: rgba(239, 68, 68, 0.4);

    --neutral-gradient: linear-gradient(135deg, #475569, #334155);

    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.08);

    --success-color: #2ecc71;
    --blue-color: #3498db;
    --warning-color: #f39c12;
    --red-color: #e74c3c;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    font-weight: 400;
    background: var(--bg-dark);
    background-image: radial-gradient(circle at 50% 0%, #1e293b 0%, #0f172a 70%);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: background-image 0.5s ease;
}

/* Pre-Exam Mode Styles */
.bg-black-mode {
    background: #000000 !important;
    /* Pure black or dark bg as requested */
    background-image: none !important;
}

.text-gray-mode {
    color: #9E9E9E !important;
}

/* --- Top Controls --- */
.top-controls {
    position: absolute;
    top: 25px;
    right: 30px;
    display: flex;
    gap: 15px;
    z-index: 10;
}

.font-controls {
    display: flex;
    gap: 5px;
    background: var(--glass-bg);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.2s;
}

.icon-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

/* --- Main Layout --- */
.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 20px;
}

.status-label {
    font-size: 6rem;
    /* Tripled size */
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
}

/* --- Timer Display --- */
.timer {
    font-family: 'Poppins', sans-serif;
    font-weight: 400;
    font-size: 15vw;
    line-height: 1;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    margin-bottom: 50px;
    color: var(--text-primary);
    transition: font-size 0.2s ease, color 0.3s ease;

    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* Strict Fixed Width for Digits - Solving Jitter */
.digit {
    display: inline-block;
    width: 0.7em;
    /* Fixed width relative to font size */
    text-align: center;
}

.sep {
    display: inline-block;
    width: 0.25em;
    opacity: 0.7;
    text-align: center;
    position: relative;
    top: -0.05em;
}

/* Removed old ID selectors since we use classes now */
/* Removed old ID selectors since we use classes now */
/* .timer span rule removed */

/* --- Progress Bar --- */
.progress-container {
    width: 80%;
    max-width: 900px;
    height: 22px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    margin-bottom: 60px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.progress-bar {
    height: 100%;
    background-color: var(--success-color);
    width: 100%;
    transition: width 1s linear, background-color 0.5s ease;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
}

.progress-green {
    background-color: var(--success-color) !important;
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.4);
}

.progress-blue {
    background-color: var(--blue-color) !important;
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.4);
}

.progress-orange {
    background-color: var(--warning-color) !important;
    box-shadow: 0 0 15px rgba(243, 156, 18, 0.4);
}

.progress-red {
    background-color: var(--red-color) !important;
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.4);
}

/* --- Controls --- */
.controls-container {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 30px;
    /* Modern Pill Shape */
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    filter: grayscale(1);
}

/* Primary Button (Start) */
.btn-primary {
    background: var(--primary-gradient);
    box-shadow: 0 4px 15px var(--primary-shadow);
}

.btn-primary:hover {
    box-shadow: 0 8px 25px var(--primary-shadow);
}

/* Secondary Button (Stop) */
.btn-secondary {
    background: var(--neutral-gradient);
    border: 1px solid var(--glass-border);
}

/* Danger Button (Reset) */
.btn-danger {
    background: var(--danger-gradient);
    box-shadow: 0 4px 15px var(--danger-shadow);
}

.btn-danger:hover {
    box-shadow: 0 8px 25px var(--danger-shadow);
}

/* Neutral Button (Settings) */
.btn-neutral {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.btn-neutral:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 20px;
}

.hidden {
    display: none !important;
}

.modal {
    background: #1e293b;
    background: linear-gradient(to bottom right, #1e293b, #0f172a);
    width: 650px;
    min-height: 450px;
    max-width: 100%;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    animation: modalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 30px 40px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.modal-header h2 {
    font-size: 1.8rem;
    font-weight: 500;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.8rem;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.modal-body {
    padding: 40px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.form-group {
    margin-bottom: 30px;
}

.form-group label {
    display: block;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 18px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
    font-size: 1.3rem;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--blue-color);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.mode-selector {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
}

.mode-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 16px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s;
    font-size: 1.2rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
}

.mode-btn.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.presets-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 15px;
}

.btn-preset {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    white-space: nowrap;
}

.btn-preset:hover {
    transform: translateY(-2px);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Specific Colors for Presets */
.btn-preset:nth-child(1) {
    /* 40 dk */
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.1));
    border-color: rgba(59, 130, 246, 0.3);
    color: #60a5fa;
}

.btn-preset:nth-child(1):hover {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.btn-preset:nth-child(2) {
    /* 75 dk */
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.1));
    border-color: rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.btn-preset:nth-child(2):hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.btn-preset:nth-child(3) {
    /* 80 dk */
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.1));
    border-color: rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.btn-preset:nth-child(3):hover {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.modal-footer {
    padding: 30px 40px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
    background: rgba(0, 0, 0, 0.2);
}

/* Clock Display */
.current-clock {
    font-family: 'Poppins', sans-serif;
    font-size: 40px;
    color: #9E9E9E;
    margin-top: 60px;
    margin-bottom: 20px;
    font-weight: 500;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    width: 100%;
    text-align: center;
}