/* CSS Reset & Variables */
:root {
    --bg-dark: #07080c;
    --card-bg: rgba(15, 18, 28, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    
    /* Athletic Track Color Palette */
    --accent-red: #ef233c;
    --accent-orange: #f85606;
    --accent-gold: #ffb703;
    --accent-teal: #06b6d4;
    
    --primary-gradient: linear-gradient(135deg, #f85606, #ffb703); /* Orange to Gold */
    --danger-gradient: linear-gradient(135deg, #ef233c, #d90429); /* Red to Dark Red */
    --glass-gradient: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    
    --primary-glow: rgba(248, 86, 6, 0.15);
    
    --font-outfit: 'Outfit', sans-serif;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-outfit);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    position: relative;
}

/* Background Effects */
.glass-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(20, 22, 33, 0.85) 0%, rgba(7, 8, 12, 0.98) 100%);
    z-index: -2;
}

.glow-orb {
    position: fixed;
    width: 450px;
    height: 450px;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.35;
    pointer-events: none;
    animation: floatOrb 20s infinite alternate ease-in-out;
}

.orb-1 {
    background: radial-gradient(circle, var(--accent-orange) 0%, rgba(248, 86, 6, 0) 70%);
    top: -100px;
    left: -50px;
}

.orb-2 {
    background: radial-gradient(circle, var(--accent-red) 0%, rgba(239, 35, 60, 0) 70%);
    bottom: -100px;
    right: -50px;
    animation-delay: -7s;
}

@keyframes floatOrb {
    0% {
        transform: translate(0, 0) scale(1);
    }
    100% {
        transform: translate(100px, 80px) scale(1.2);
    }
}

/* Main Container */
.app-container {
    width: 100%;
    max-width: 1280px;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 100vh;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--card-border);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-emoji {
    font-size: 2.8rem;
    filter: drop-shadow(0 0 10px rgba(248, 86, 6, 0.5));
    animation: sprint 1.5s infinite ease-in-out alternate;
}

@keyframes sprint {
    0% { transform: skewX(-5deg); }
    100% { transform: skewX(10deg); }
}

.logo-text h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, var(--accent-orange), var(--accent-red));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text p {
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* Layout Grid */
.grid-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.left-section, .right-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Glass Card */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 1.5rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    transition: var(--transition-smooth);
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.75rem;
}

/* Colors for Titles */
.text-gold { color: var(--accent-gold); }
.text-silver { color: #cbd5e1; }
.text-orange { color: var(--accent-orange); }
.text-teal { color: var(--accent-teal); }

/* PB Grid */
.pb-grid {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.pb-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    transition: var(--transition-smooth);
}

.pb-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
    border-color: rgba(248, 86, 6, 0.25);
}

.pb-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
}

.pb-value-group {
    text-align: right;
}

.pb-value {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--accent-orange);
    text-shadow: 0 0 8px rgba(248, 86, 6, 0.2);
}

.pb-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Form Styles */
form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

input, select {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    color: #ffffff;
    font-family: var(--font-outfit);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-smooth);
}

input:focus, select:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-orange);
    box-shadow: 0 0 10px rgba(248, 86, 6, 0.2);
}

select option {
    background-color: #0f121c;
    color: #ffffff;
}

/* Buttons */
.btn {
    font-family: var(--font-outfit);
    font-size: 0.95rem;
    font-weight: 700;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: var(--primary-gradient);
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(248, 86, 6, 0.4);
    filter: brightness(1.1);
}

.btn-danger {
    background: var(--danger-gradient);
}

.btn-danger:hover {
    filter: brightness(1.1);
}

/* History Log Header */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.75rem;
}

.history-header h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.filters {
    display: flex;
    gap: 0.75rem;
}

.filters select {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

/* Table Card Styling */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

thead th {
    padding: 0.85rem 1rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 2px solid rgba(255, 255, 255, 0.08);
}

tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition-smooth);
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

tbody td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    font-size: 0.95rem;
}

.athlete-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

.athlete-badge.Gonzalo {
    background: rgba(255, 183, 3, 0.15);
    color: var(--accent-gold);
    border: 1px solid rgba(255, 183, 3, 0.3);
}

.athlete-badge.Rodrigo {
    background: rgba(203, 213, 225, 0.15);
    color: #cbd5e1;
    border: 1px solid rgba(203, 213, 225, 0.3);
}

.athlete-badge.Relevo {
    background: rgba(248, 86, 6, 0.15);
    color: var(--accent-orange);
    border: 1px solid rgba(248, 86, 6, 0.3);
}

.event-cell {
    font-weight: 600;
}

.time-cell {
    font-weight: 700;
    color: #ffffff;
}

.wind-cell {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.venue-cell {
    color: var(--text-muted);
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-delete-mark, .btn-edit-mark {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.35rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

tbody tr:hover .btn-delete-mark, tbody tr:hover .btn-edit-mark {
    color: var(--text-muted);
}

.btn-delete-mark:hover {
    color: var(--accent-red) !important;
    background: rgba(239, 35, 60, 0.1);
}

.btn-edit-mark:hover {
    color: var(--accent-teal) !important;
    background: rgba(6, 182, 212, 0.1);
}

.btn-edit-mark {
    margin-right: 0.25rem;
}

/* Footer */
footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 1.5rem 0 0.5rem 0;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Custom Scrollbar */
.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Responsive queries */
@media (max-width: 992px) {
    .grid-layout {
        grid-template-columns: 1fr;
    }
    
    .left-section {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .app-container {
        padding: 1rem 0.75rem;
    }
    
    .card {
        padding: 1rem;
        border-radius: var(--radius-md);
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .history-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .filters {
        width: 100%;
    }
    
    .filters select {
        flex-grow: 1;
    }
    
    thead th, tbody td {
        padding: 0.65rem 0.5rem;
        font-size: 0.85rem;
    }
}
