/* --- Nollställning & Basstilar --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #0d0f1d;
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    padding: 16px;
}

/* --- Bakgrundseffekter (Glödande orber) --- */
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.6;
    animation: float 12s infinite alternate ease-in-out;
}

.orb-1 {
    width: 280px;
    height: 280px;
    background: #7928ca;
    top: -40px;
    left: -40px;
}

.orb-2 {
    width: 320px;
    height: 320px;
    background: #ff0080;
    bottom: -60px;
    right: -40px;
    animation-delay: -4s;
}

.orb-3 {
    width: 220px;
    height: 220px;
    background: #0070f3;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -8s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 40px) scale(1.15); }
}

/* --- Main Layout --- */
.app-container {
    width: 100%;
    max-width: 420px;
    z-index: 1;
}

/* --- Glastemat Card --- */
.glass-card {
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 32px;
    padding: 28px 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* --- Header --- */
.header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.icon-badge {
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 10px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.9);
}

/* --- Tidsvisning --- */
.display-container {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 24px 12px 18px;
    text-align: center;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.main-time {
    font-family: 'Roboto Mono', monospace;
    font-size: 2.8rem;
    font-weight: 600;
    letter-spacing: -1px;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.colon {
    opacity: 0.7;
    margin: 0 -2px;
    animation: pulse 1s infinite alternate;
}

.milliseconds-wrapper {
    margin-top: 4px;
    font-family: 'Roboto Mono', monospace;
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

/* --- Knappar --- */
.controls {
    display: grid;
    grid-template-columns: 1fr 1.3fr 1fr;
    gap: 12px;
    align-items: center;
}

.btn {
    border: none;
    outline: none;
    padding: 14px 10px;
    border-radius: 20px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
}

.btn:active:not(:disabled) {
    transform: scale(0.94);
}

.btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}

/* Sekundära knappar (Återställ & Varv) */
.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
}

/* Primär knapp (Start / Paus) */
.btn-primary.start {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
    padding: 16px 10px;
}

.btn-primary.start:hover {
    box-shadow: 0 10px 28px rgba(16, 185, 129, 0.5);
}

.btn-primary.pause {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.35);
    padding: 16px 10px;
}

.btn-primary.pause:hover {
    box-shadow: 0 10px 28px rgba(239, 68, 68, 0.5);
}

.hidden {
    display: none !important;
}

/* --- Varvtidslista --- */
.laps-container {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 14px;
    max-height: 220px;
    display: flex;
    flex-direction: column;
}

.laps-header {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr 1.2fr;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4);
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.laps-list {
    list-style: none;
    overflow-y: auto;
    max-height: 160px;
    padding-right: 4px;
}

/* Snygg scrollbar */
.laps-list::-webkit-scrollbar {
    width: 4px;
}
.laps-list::-webkit-scrollbar-track {
    background: transparent;
}
.laps-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.laps-list li {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr 1.2fr;
    padding: 10px 0;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    text-align: center;
    color: rgba(255, 255, 255, 0.85);
    animation: slideDown 0.3s ease-out;
}

.laps-list li:last-child {
    border-bottom: none;
}

.empty-state {
    display: block !important;
    text-align: center;
    color: rgba(255, 255, 255, 0.3) !important;
    font-family: 'Outfit', sans-serif !important;
    font-size: 0.85rem;
    padding: 20px 0 !important;
}

/* Highlights för Snabbaste och Långsammaste varv */
.lap-fastest {
    color: #34d399 !important; /* Grön */
}

.lap-slowest {
    color: #f87171 !important; /* Röd */
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
