/* =========================================
   Global Variables & Reset
========================================= */
:root {
    --primary-color: #4361EE; 
    --secondary-color: #F72585; 
    --success-color: #06D6A0;
    --warning-color: #FFD166;
    --danger-color: #EF476F;
    --bg-color: #F4F7FE; 
    --card-bg: #FFFFFF;
    --text-main: #2B2D42;
    --text-muted: #8D99AE;
    --border-radius: 20px;
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

body.dark-mode {
    --bg-color: #0F172A; 
    --card-bg: #1E293B; 
    --text-main: #F8FAFC; 
    --text-muted: #94A3B8; 
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); 
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Nunito', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    text-decoration: none;
    color: inherit;
}

/* =========================================
   Navbar (Header)
========================================= */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5%;
    background: var(--card-bg);
    box-shadow: var(--box-shadow);
    transition: background-color 0.3s ease;
}

.logo { font-size: 20px; font-weight: 800; }
.highlight { color: var(--primary-color); }
.theme-btn {
    background: transparent; border: none;
    font-size: 1.4rem; cursor: pointer;
    transition: transform 0.3s ease;
}
.theme-btn:hover { transform: scale(1.2) rotate(15deg); }

/* =========================================
   Main Tool Layout
========================================= */
.tool-container {
    display: flex; justify-content: center; padding: 40px 5%;
}

.tool-card {
    background: var(--card-bg); width: 100%; max-width: 700px;
    padding: 40px; border-radius: var(--border-radius);
    box-shadow: var(--box-shadow); text-align: center;
    transition: background-color 0.3s ease;
}

.subtitle { color: var(--text-muted); margin-bottom: 30px; font-size: 0.95rem; }
.hidden { display: none !important; }

/* =========================================
   Tabs Interface
========================================= */
.tabs-container {
    display: flex; background: var(--bg-color); border-radius: 12px;
    margin-bottom: 30px; padding: 5px;
}

.tab-btn {
    flex: 1; padding: 12px; border: none; background: transparent;
    font-size: 1.1rem; font-weight: 800; color: var(--text-muted);
    border-radius: 8px; cursor: pointer; transition: all 0.3s ease;
}

.tab-btn.active {
    background: var(--card-bg); color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

/* =========================================
   Digital Clock Display
========================================= */
.time-display {
    font-family: 'Roboto Mono', monospace;
    font-size: 4.5rem; font-weight: 700; color: var(--text-main);
    letter-spacing: -2px; margin-bottom: 30px;
    display: flex; justify-content: center; align-items: baseline;
}

.milliseconds {
    font-size: 2rem; color: var(--text-muted); margin-left: 5px;
}

/* =========================================
   Timer Inputs (Setup Mode)
========================================= */
.time-inputs {
    display: flex; justify-content: center; align-items: center; gap: 15px;
    margin-bottom: 30px;
}

.time-inputs div {
    display: flex; flex-direction: column; align-items: center;
}

.time-inputs label {
    font-size: 0.85rem; font-weight: 800; color: var(--text-muted);
    text-transform: uppercase; margin-bottom: 5px;
}

.time-inputs input {
    width: 80px; font-family: 'Roboto Mono', monospace;
    font-size: 3rem; font-weight: 700; text-align: center;
    background: var(--bg-color); color: var(--text-main);
    border: 2px solid transparent; border-radius: 12px;
    padding: 10px 0; outline: none; transition: border-color 0.3s;
}

.time-inputs input:focus { border-color: var(--primary-color); }
.colon { font-size: 3rem; font-weight: 700; color: var(--text-muted); margin-top: 15px; }

/* Hide arrows on number inputs */
input[type="number"]::-webkit-inner-spin-button, 
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none; margin: 0;
}

/* =========================================
   Controls Grid & Buttons
========================================= */
.controls-grid {
    display: flex; justify-content: center; gap: 15px; margin-bottom: 30px; flex-wrap: wrap;
}

.action-btn, .secondary-btn, .clear-btn {
    padding: 12px 30px; font-size: 1.1rem; font-weight: 800;
    border: none; border-radius: 12px; cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s; min-width: 120px;
}

.action-btn:hover, .secondary-btn:hover, .clear-btn:hover {
    transform: translateY(-2px);
}

.start-btn { background: var(--success-color); color: #1e293b; box-shadow: 0 4px 15px rgba(6, 214, 160, 0.3); }
.pause-btn { background: var(--warning-color); color: #1e293b; box-shadow: 0 4px 15px rgba(255, 209, 102, 0.3); }
.secondary-btn { background: var(--bg-color); color: var(--text-main); }
.secondary-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.clear-btn { background: rgba(141, 153, 174, 0.2); color: var(--text-main); }

/* =========================================
   Laps Section
========================================= */
.lap-container {
    background: var(--bg-color); border-radius: 15px; padding: 20px;
    text-align: left; margin-top: 20px; animation: fadeIn 0.3s ease;
}

.lap-header {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 2px solid rgba(141, 153, 174, 0.2); padding-bottom: 10px;
    margin-bottom: 10px; font-weight: 800;
}

.lap-list {
    list-style: none; max-height: 250px; overflow-y: auto;
}

.lap-list li {
    display: flex; justify-content: space-between; font-family: 'Roboto Mono', monospace;
    padding: 10px 0; border-bottom: 1px dashed rgba(141, 153, 174, 0.2);
    font-size: 1.05rem; color: var(--text-main);
}
.lap-list li:last-child { border-bottom: none; }

.lap-index { color: var(--text-muted); font-family: 'Nunito', sans-serif; font-weight: 800; }
.lap-diff { color: var(--primary-color); }

/* =========================================
   SEO Content & FAQ
========================================= */
.content-section {
    max-width: 800px; margin: 0 auto 40px; padding: 30px;
    background: var(--card-bg); border-radius: var(--border-radius);
    box-shadow: var(--box-shadow); transition: background-color 0.3s ease;
}
.content-section h2, .content-section h3 { color: var(--text-main); }
.content-section h2 { color: var(--primary-color); margin-bottom: 20px; }
.content-section p, .content-section ol { margin-bottom: 15px; color: var(--text-muted); }
.content-section ol { padding-left: 20px; }
.faq-item { margin-bottom: 20px; border-bottom: 1px solid rgba(141, 153, 174, 0.2); padding-bottom: 15px; }
.faq-item:last-child { border-bottom: none; }
footer { text-align: center; padding: 30px 5%; margin-top: 20px; color: var(--text-muted); }

/* =========================================
   Mobile Responsiveness
========================================= */
@media (max-width: 600px) {
    .tool-card { padding: 25px 15px; }
    .time-display { font-size: 3rem; }
    .milliseconds { font-size: 1.3rem; }
    .time-inputs input { width: 65px; font-size: 2.2rem; }
    .colon { font-size: 2.2rem; }
    .controls-grid { gap: 10px; }
    .action-btn, .secondary-btn, .clear-btn { flex: 1; min-width: 45%; padding: 12px 10px; }
}

/* =========================================
   Cookie Consent Banner (Original PC, Compact Mobile)
========================================= */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 800px; /* Restored to original PC size */
    background: var(--card-bg);
    border-radius: var(--border-radius, 20px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 20px 30px; /* Restored to original PC padding */
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 9999;
    border: 2px solid var(--primary-color);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s ease;
}

/* Hidden state for smooth animation */
.cookie-banner.hidden {
    transform: translate(-50%, 150px);
    opacity: 0;
    pointer-events: none;
}

.cookie-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cookie-icon {
    font-size: 35px; /* Restored to original PC size */
}

.cookie-content p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.5;
}

.cookie-content a {
    color: var(--primary-color);
    font-weight: 800;
    text-decoration: underline;
}

.cookie-btn {
    background-color: var(--primary-color);
    padding: 12px 25px; /* Restored to original PC size */
    font-size: 1.05rem;
    width: auto;
    white-space: nowrap;
    margin-left: 20px;
}

/* =========================================
   Mobile Responsiveness (Micro Version)
========================================= */
@media (max-width: 600px) {
    .cookie-banner {
        flex-direction: column;
        gap: 6px;
        padding: 8px 12px; /* Bare minimum top and bottom padding */
        bottom: 0; /* Flushes the banner to the absolute bottom of the screen */
        border-radius: 15px 15px 0 0; /* Rounded top, flat bottom to save space */
        border-bottom: none;
        width: 100%; /* Stretches edge-to-edge on mobile */
    }
   
    .cookie-content {
        flex-direction: row; /* Puts the emoji NEXT to the text to save a whole line of height! */
        align-items: flex-start;
        text-align: left;
        gap: 8px;
    }

    .cookie-icon {
        font-size: 18px; /* Micro emoji */
        margin-top: 2px;
    }

    .cookie-content p {
        font-size: 0.75rem; /* Smallest comfortable reading size */
        line-height: 1.2; /* Tightly packs the text lines together */
    }
   
    .cookie-btn {
        width: 100%;
        margin-left: 0;
        padding: 6px; /* Extremely thin button vertically */
        font-size: 0.85rem;
        border-radius: 8px;
    }
}