/* stoper.css */

/* Hero Section */
.stoper-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem 1rem;
    margin-bottom: 2rem;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
}

/* Circular Timer */
.timer-circle-container {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

.timer-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg); /* Start at top */
}

.track {
    fill: none;
    stroke: rgba(255,255,255,0.1);
    stroke-width: 3;
}

body.light-mode .track {
    stroke: rgba(0,0,0,0.05);
}

.progress {
    fill: none;
    stroke: var(--accent-color);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 283; /* 2 * PI * 45 */
    stroke-dashoffset: 283; /* Starts empty */
    transition: stroke-dashoffset 0.1s linear;
}

.time-display-wrapper {
    z-index: 2;
    text-align: center;
    display: flex;
    align-items: baseline;
    justify-content: center;
}

.main-time {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(0,0,0,0.2);
    font-variant-numeric: tabular-nums;
}

.ms-time {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-secondary);
    width: 60px; /* Fixed width to prevent jumping */
    text-align: left;
    font-variant-numeric: tabular-nums;
}

/* Controls */
.controls-wrapper {
    display: flex;
    gap: 2rem;
    width: 100%;
    max-width: 400px;
    justify-content: center;
}

.controls-wrapper button {
    flex: 1;
    height: 60px;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 30px; /* Pill shape */
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.controls-wrapper button:active {
    transform: scale(0.95);
}

.primary-control {
    background: rgba(81, 207, 102, 0.2);
    border-color: rgba(81, 207, 102, 0.5);
    color: #51cf66;
}

.primary-control:hover {
    background: rgba(81, 207, 102, 0.4);
    box-shadow: 0 0 15px rgba(81, 207, 102, 0.4);
    color: white;
}

.primary-control.running {
    background: rgba(255, 107, 107, 0.2);
    border-color: rgba(255, 107, 107, 0.5);
    color: #ff6b6b;
}

.primary-control.running:hover {
    background: rgba(255, 107, 107, 0.4);
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.4);
    color: white;
}

.secondary-control {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.2);
    color: var(--text-primary);
}

body.light-mode .secondary-control {
    background: rgba(0,0,0,0.05);
    border-color: rgba(0,0,0,0.1);
}

.secondary-control:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.keyboard-hint {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Stats & Laps Grid */
.laps-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

.stats-panel {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 1.2rem;
    border-radius: 16px;
    position: relative;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.stat-box .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.stat-box .value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.divider-v {
    width: 1px;
    height: 40px;
    background: rgba(255,255,255,0.1);
}

body.light-mode .divider-v {
    background: rgba(0,0,0,0.1);
}

.copy-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* Laps List */
.laps-list-panel {
    padding: 0;
    border-radius: 16px;
    overflow: hidden;
    height: 400px; /* Fixed height for scroll */
    display: flex;
    flex-direction: column;
}

.laps-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 1rem 1.5rem;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-align: center;
}

body.light-mode .laps-header {
    background: rgba(0,0,0,0.02);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.laps-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

/* Scrollbar styling */
.laps-scroll-area::-webkit-scrollbar {
    width: 6px;
}
.laps-scroll-area::-webkit-scrollbar-track {
    background: transparent;
}
.laps-scroll-area::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

.lap-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 0.8rem 1.5rem;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255,255,255,0.02);
    animation: fadeIn 0.3s ease-out;
}

.lap-row:last-child {
    border-bottom: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.lap-index {
    color: var(--text-secondary);
}

/* Analysis Colors */
.lap-row.best .split-time {
    color: #51cf66;
    font-weight: 700;
}

.lap-row.worst .split-time {
    color: #ff6b6b;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-style: italic;
    opacity: 0.6;
}

/* Utility */
.mono-font {
    font-family: 'JetBrains Mono', monospace;
}

/* Responsive */
@media (max-width: 600px) {
    .main-time { font-size: 2.8rem; }
    .ms-time { font-size: 1.2rem; }
    .timer-circle-container { width: 240px; height: 240px; }
    .copy-btn { position: relative; right: auto; top: auto; transform: none; margin-top: 0.5rem;}
    .stats-panel { flex-direction: column; gap: 0.8rem; }
    .divider-v { width: 100%; height: 1px; }
}
