/* =============================================
   IRM-HUB Finisher - Operador Styles
   ============================================= */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #222240;
    --border: #2a2a45;
    --text-primary: #f0f0f5;
    --text-secondary: #8888aa;
    --text-muted: #55556e;
    --accent: #00d4ff;
    --accent-glow: rgba(0, 212, 255, 0.15);
    --purple: #7c3aed;
    --purple-glow: rgba(124, 58, 237, 0.15);
    --swim-color: #00bcd4;
    --bike-color: #ff9800;
    --run-color: #4caf50;
    --finish-color: #e91e63;
    --success: #22c55e;
    --error: #ef4444;
    --radius: 16px;
    --radius-sm: 10px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.app {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 32px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon svg {
    width: 44px;
    height: 44px;
}

.header-brand h1 {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 2px;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 8px 14px;
    border-radius: 100px;
    border: 1px solid var(--border);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--error);
    transition: background 0.3s;
}

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {

    0%,
    100% {
        box-shadow: 0 0 4px var(--success);
    }

    50% {
        box-shadow: 0 0 12px var(--success);
    }
}

/* Search */
.search-section {
    margin-bottom: 28px;
}

.search-box label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.search-row {
    display: flex;
    gap: 10px;
}

.search-row input {
    flex: 1;
    padding: 16px 20px;
    font-size: 1.2rem;
    font-family: var(--font-mono);
    font-weight: 600;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    outline: none;
    transition: all 0.25s;
    letter-spacing: 0.08em;
}

.search-row input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.search-row input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.95rem;
    letter-spacing: 0;
}

.search-row button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 28px;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s;
    white-space: nowrap;
    font-family: var(--font);
}

.search-row button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.25);
}

.search-row button:active {
    transform: translateY(0);
}

/* Athlete Card */
.athlete-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.athlete-header {
    display: flex;
    align-items: center;
    gap: 20px;
}

.bib-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    height: 72px;
    padding: 0 12px;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    border-radius: var(--radius-sm);
    font-size: 1.7rem;
    font-weight: 900;
    font-family: var(--font-mono);
    color: #fff;
    letter-spacing: 0.05em;
}

.athlete-info h2 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}

.athlete-details {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.athlete-details .sep {
    margin: 0 6px;
    opacity: 0.4;
}

/* Times Grid */
.times-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.time-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.time-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
}

.time-card.swim::before {
    background: var(--swim-color);
}

.time-card.bike::before {
    background: var(--bike-color);
}

.time-card.run::before {
    background: var(--run-color);
}

.time-card.finish::before {
    background: var(--finish-color);
}

.time-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.1);
}

.time-icon {
    font-size: 1.6rem;
    margin-bottom: 6px;
}

.time-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 8px;
}

.time-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
}

.time-card.swim .time-value {
    color: var(--swim-color);
}

.time-card.bike .time-value {
    color: var(--bike-color);
}

.time-card.run .time-value {
    color: var(--run-color);
}

.time-card.finish .time-value {
    color: var(--finish-color);
}

/* Splits Details */
.splits-details {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
}

.splits-details summary {
    padding: 16px 20px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.splits-details summary:hover {
    color: var(--text-primary);
}

.splits-table-wrap {
    padding: 0 20px 20px;
    overflow-x: auto;
}

.splits-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.splits-table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 700;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 1px solid var(--border);
}

.splits-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-family: var(--font-mono);
    font-size: 0.84rem;
}

.splits-table tr:last-child td {
    border-bottom: none;
}

/* Action Bar */
.action-bar {
    display: flex;
    gap: 12px;
}

.btn-send {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px 24px;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s;
    font-family: var(--font);
}

.btn-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3);
}

.btn-send:active {
    transform: translateY(0);
}

.btn-clear {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 18px 20px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    font-family: var(--font);
}

.btn-clear:hover {
    color: var(--error);
    border-color: var(--error);
}

/* Error */
.error-section {
    margin-top: 20px;
}

.error-card {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
}

.error-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
}

.error-card p {
    color: var(--error);
    font-weight: 600;
    font-size: 0.95rem;
}

/* Loading */
.loading-section {
    text-align: center;
    padding: 60px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-section p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Fade animations */
.fade-in {
    animation: fadeIn 0.35s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 500px) {
    .times-grid {
        grid-template-columns: 1fr;
    }

    .search-row {
        flex-direction: column;
    }

    .action-bar {
        flex-direction: column;
    }

    .athlete-header {
        flex-direction: column;
        text-align: center;
    }
}