/* Stopwatch specific styles */

.stopwatch-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    max-width: 500px; /* Limit width for better centering */
    margin: 20px auto; /* Center the container */
    background-color: var(--background-color); /* Use variables from style.css */
    color: var(--text-color);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.stopwatch-display {
    font-family: 'DS-Digital', sans-serif; /* Digital-style font */
    font-size: 4rem; /* Large display */
    margin-bottom: 20px;
    color: var(--accent-color); /* Use accent color for the timer */
    letter-spacing: 2px;
    /* Optional: Add subtle shadow for depth */
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

/* Make hundredths smaller */
.stopwatch-display #hundredths {
    font-family: 'DS-Digital', sans-serif;
    font-size: 0.5em; /* Adjust size relative to the parent - made smaller */
    vertical-align: baseline; /* Align nicely with the seconds */
}

.stopwatch-controls {
    display: flex;
    justify-content: center; /* Center buttons */
    gap: 20px; /* Space between buttons */
    margin-bottom: 30px;
    width: 100%; /* Ensure controls take full width for centering */
}

.stopwatch-controls .btn {
    padding: 12px 25px;
    font-size: 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    min-width: 100px; /* Ensure buttons have a minimum width */
    text-align: center;
}

.stopwatch-controls .btn:active {
    transform: scale(0.98); /* Slight press effect */
}

.stopwatch-controls .btn-start {
    background-color: #28a745; /* Green for Start/Lap */
    color: white;
}

.stopwatch-controls .btn-start:hover {
    background-color: #218838;
}

/* Style for Lap button state - keep green background */
.stopwatch-controls .btn-lap {
    /* Inherits base styles, just need to ensure background remains consistent if needed */
    /* Or explicitly set it if there are overrides */
     background-color: #28a745; /* Same Green as Start */
     color: white;
}

.stopwatch-controls .btn-lap:hover {
     background-color: #218838; /* Same hover as Start */
}

/* Styles for Pause/Resume button */
.stopwatch-controls .btn-pause {
    background-color: #007bff; /* Blue for Pause */
    color: white;
}

.stopwatch-controls .btn-pause:hover {
    background-color: #0056b3;
}

/* Resume state might use the same style or a slightly different one if needed */
.stopwatch-controls .btn-resume {
    background-color: #007bff; /* Same Blue for Resume */
    color: white;
}

.stopwatch-controls .btn-resume:hover {
    background-color: #0056b3;
}


.stopwatch-controls .btn-reset {
    background-color: #fd7e14; /* Orange for Reset */
    color: white;
}

.stopwatch-controls .btn-reset:hover {
    background-color: #e86a00;
}

/* Initially hide reset button if needed, or disable it via JS */
/* .stopwatch-controls .btn-reset { display: none; } */


.lap-table-container {
    width: 100%;
    /* max-height: 300px; */ /* Removed to allow expansion */
    /* overflow-y: auto; */ /* Removed as height is not limited */
    border: 1px solid var(--border-color); /* Use variable */
    border-radius: 5px;
    margin-top: 20px; /* Space above the table */
}

#lap-table {
    width: 100%;
    border-collapse: collapse; /* Clean table lines */
    color: var(--text-color); /* Use variable */
}

#lap-table th,
#lap-table td {
    padding: 10px 15px;
    text-align: center;
    border-bottom: 1px solid var(--border-color); /* Use variable */
}

#lap-table thead th {
    background-color: var(--table-header-bg); /* Use variable */
    color: var(--table-header-text); /* Use variable */
    position: sticky; /* Keep header visible on scroll */
    top: 0;
    z-index: 1;
    border: 1px solid grey;
}

#lap-table tbody tr:last-child td {
    border-bottom: none; /* Remove border from last row */
}

#lap-table tbody tr:nth-child(even) {
    background-color: var(--table-row-alt-bg); /* Subtle striping */
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .stopwatch-display {
        font-size: 3rem; /* Smaller font on small screens */
    }

    .stopwatch-controls {
        flex-direction: column; /* Stack buttons vertically */
        gap: 15px;
    }

    .stopwatch-controls .btn {
        width: 80%; /* Make buttons wider */
        margin: 0 auto; /* Center stacked buttons */
    }

    .lap-table-container {
        /* max-height: 250px; */ /* Removed to allow expansion */
    }

     #lap-table th,
     #lap-table td {
        padding: 8px 10px; /* Reduce padding */
    }
}

@media (max-width: 400px) {
    .stopwatch-display {
        font-size: 2.5rem;
    }
     h1 {
        font-size: 1.5rem;
     }
}
