/* Variables de Diseño */
:root {
    --bg-main: #1e1e2e;
    --bg-card: #252538;
    --text-main: #cdd6f4;
    --text-muted: #7f849c;
    
    /* Colores de Botones */
    --color-start: #a6e3a1;
    --color-start-hover: #b8f2b3;
    --color-pause: #f38ba8;
    --color-pause-hover: #fba3b9;
    --color-lap: #89b4fa;
    --color-lap-hover: #a4c7fb;
    --color-reset: #f9e2af;
    --color-reset-hover: #faebd7;
    --color-danger: #f38ba8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
    width: 100%;
    max-width: 1100px;
    background-color: var(--bg-card);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Sección del Cronómetro */
.stopwatch-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    border-right: 1px solid #313244;
}

h1, h2 {
    font-weight: 600;
    letter-spacing: -0.5px;
    margin-bottom: 20px;
}

.display {
    font-size: 5.5rem;
    font-family: monospace;
    font-weight: bold;
    margin: 40px 0;
    background: linear-gradient(135deg, #cdd6f4, #89b4fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 12px rgba(137, 180, 250, 0.1);
}

.controls {
    display: flex;
    gap: 15px;
    width: 100%;
    justify-content: center;
}

/* Botones */
.btn {
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 110px;
}

.btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    filter: grayscale(1);
}

.btn-start { background-color: var(--color-start); color: #11111b; }
.btn-start:hover:not(:disabled) { background-color: var(--color-start-hover); }

.btn-pause { background-color: var(--color-pause); color: #11111b; }
.btn-pause:hover:not(:disabled) { background-color: var(--color-pause-hover); }

.btn-lap { background-color: var(--color-lap); color: #11111b; }
.btn-lap:hover:not(:disabled) { background-color: var(--color-lap-hover); }

.btn-reset { background-color: var(--color-reset); color: #11111b; }
.btn-reset:hover:not(:disabled) { background-color: var(--color-reset-hover); }

.hidden { display: none; }

/* Sección del Historial */
.history-section {
    display: flex;
    flex-direction: column;
    max-height: 450px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.btn-clear-all {
    background: transparent;
    border: 1px solid var(--color-danger);
    color: var(--color-danger);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.btn-clear-all:hover {
    background-color: var(--color-danger);
    color: #11111b;
}

.history-container {
    overflow-y: auto;
    flex-grow: 1;
    border: 1px solid #313244;
    border-radius: 8px;
    background-color: #1e1e2e;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.history-table th, .history-table td {
    padding: 12px;
    border-bottom: 1px solid #313244;
}

.history-table th {
    background-color: #181825;
    color: var(--text-muted);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.btn-delete {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
}

.btn-delete:hover {
    color: var(--color-danger);
}

.history-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-style: italic;
}

/* Responsive */
@media (max-width: 850px) {
    .container {
        grid-template-columns: 1fr;
    }
    .stopwatch-section {
        border-right: none;
        border-bottom: 1px solid #313244;
        padding-bottom: 30px;
    }
    .history-section {
        max-height: 350px;
    }
}