@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;800&family=Outfit:wght@300;400;500;700&family=Share+Tech+Mono&display=swap');

:root {
    --bg-primary: #f3f5f9;
    --bg-secondary: #ffffff;
    --bg-tertiary: #edf2f7;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    
    --accent-cyan: #0ea5e9;
    --accent-blue: #2563eb;
    --accent-glow: rgba(37, 99, 235, 0.12);
    
    --color-gold: #d97706;
    --color-silver: #475569;
    --color-bronze: #b45309;
    
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.02);
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    
    --font-sans: 'Outfit', sans-serif;
    --font-heading: 'Montserrat', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
    
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(226, 232, 240, 0.6) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(14, 165, 233, 0.08) 0px, transparent 50%),
        radial-gradient(at 50% 0%, rgba(99, 102, 241, 0.06) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: var(--radius-sm);
    border: 2px solid var(--bg-primary);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

/* Main Container */
.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header & Logo styling */
header {
    margin-bottom: 2.5rem;
    position: relative;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

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

.logo-badge {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    color: #ffffff;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.5rem;
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.logo-title h1 {
    font-size: 1.8rem;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-primary) 50%, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-title p {
    font-size: 0.9rem;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
}

/* Event General Metrics Strip */
.stats-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--glass-shadow);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--accent-cyan), var(--accent-blue));
    opacity: 0.8;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(37, 99, 235, 0.2);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.05);
}

.stat-icon {
    font-size: 2rem;
    background: rgba(14, 165, 233, 0.08);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--accent-cyan);
}

.stat-info .stat-value {
    font-family: var(--font-mono);
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

.stat-info .stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Main Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 2.5rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Left Panel: Search, Category Filters, and Table */
.results-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--glass-shadow);
}

.panel-header {
    margin-bottom: 2rem;
}

.panel-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.panel-header h2::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.3);
}

.panel-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Search & Filters Controls */
.controls-area {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.filter-container {
    background: var(--bg-tertiary);
    padding: 1.2rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
}

.filter-title {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-title i {
    color: var(--accent-blue);
}

.search-wrapper {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.2rem 1.1rem 3.2rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    transition: var(--transition-smooth);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.01);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.12);
}

.search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.2rem;
    pointer-events: none;
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.filter-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 0.6rem 1.2rem;
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.85rem;
    border-radius: 100px;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.filter-btn:hover {
    color: var(--text-primary);
    border-color: #cbd5e1;
    background: #f8fafc;
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    color: #ffffff;
    border-color: transparent;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.2);
}

/* Results Table */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    background: var(--bg-secondary);
}

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

thead {
    background: #f8fafc;
    border-bottom: 1px solid var(--glass-border);
}

th {
    padding: 1rem 1.25rem;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

tbody tr {
    border-bottom: 1px solid var(--glass-border);
    transition: var(--transition-smooth);
    cursor: pointer;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: #f8fafc;
}

tbody tr.selected {
    background: rgba(14, 165, 233, 0.05);
    border-left: 3px solid var(--accent-cyan);
}

td {
    padding: 1.1rem 1.25rem;
    font-size: 0.95rem;
    vertical-align: middle;
}

/* Badges */
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.85rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.rank-podium-1 {
    background: linear-gradient(135deg, #ffe066, #f59e0b);
    color: #78350f;
    box-shadow: 0 2px 5px rgba(217, 119, 6, 0.2);
}

.rank-podium-2 {
    background: linear-gradient(135deg, #ffffff, #cbd5e1);
    color: #1e293b;
    box-shadow: 0 2px 5px rgba(100, 116, 139, 0.15);
}

.rank-podium-3 {
    background: linear-gradient(135deg, #ffedd5, #ea580c);
    color: #7c2d12;
    box-shadow: 0 2px 5px rgba(234, 88, 12, 0.2);
}

.bib-badge {
    background: var(--bg-tertiary);
    color: var(--accent-blue);
    font-family: var(--font-mono);
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid rgba(37, 99, 235, 0.1);
}

.runner-name {
    font-weight: 600;
    color: var(--text-primary);
}

.runner-category {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: block;
    margin-top: 0.2rem;
}

.runner-city {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.runner-time {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.05rem;
}

.status-badge {
    display: inline-flex;
    padding: 0.2rem 0.6rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-dns {
    background: #fee2e2;
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.15);
}

/* Action button in table */
.action-cell {
    text-align: right;
}

.btn-table-action {
    background: transparent;
    border: 1px solid var(--accent-cyan);
    color: var(--accent-cyan);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-table-action:hover {
    background: var(--accent-cyan);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.3);
}

/* Mobile cards for table fallback */
@media (max-width: 600px) {
    .table-container {
        border: none;
        background: transparent;
    }
    table, thead, tbody, th, td, tr {
        display: block;
    }
    thead {
        display: none;
    }
    tbody tr {
        background: var(--bg-secondary);
        border: 1px solid var(--glass-border);
        border-radius: var(--radius-md);
        margin-bottom: 1rem;
        padding: 1rem;
        box-shadow: var(--glass-shadow);
    }
    tbody tr.selected {
        border: 1px solid var(--accent-cyan);
        border-left: 4px solid var(--accent-cyan);
    }
    td {
        padding: 0.4rem 0;
        border: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    td::before {
        content: attr(data-label);
        font-family: var(--font-heading);
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        color: var(--text-secondary);
    }
    .action-cell {
        justify-content: flex-end;
        margin-top: 0.5rem;
        border-top: 1px solid var(--glass-border);
        padding-top: 0.75rem;
    }
    .action-cell::before {
        display: none;
    }
}

/* Right Panel: Certificate Display */
.display-panel {
    position: sticky;
    top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.no-selection-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 4rem 2rem;
    text-align: center;
    box-shadow: var(--glass-shadow);
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    min-height: 450px;
}

.radar-animation {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(14, 165, 233, 0.04);
    border: 1px solid rgba(14, 165, 233, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    color: var(--accent-cyan);
    position: relative;
}

.radar-animation::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid var(--accent-cyan);
    animation: radar-pulse 2s infinite linear;
}

@keyframes radar-pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

/* Diploma Interactive Container */
.diploma-display {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--glass-shadow);
}

.diploma-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Embedded PDF Viewer Styles */
.pdf-viewer-container {
    width: 100%;
    aspect-ratio: 1.414; /* A4 aspect ratio (horizontal) */
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.diploma-pdf-embed {
    width: 100%;
    height: 100%;
    border: none;
    background: #ffffff;
}

/* Action Buttons below Diploma */
.diploma-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
    flex: 1;
    min-width: 130px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.9rem 1.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--text-primary);
    transform: translateY(-2px);
}

/* Footer Section */
footer.main-footer {
    text-align: center;
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-size: 0.9rem;
}

footer.main-footer a {
    color: var(--accent-blue);
    text-decoration: none;
}

footer.main-footer a:hover {
    text-decoration: underline;
}

/* Mobile Modal Overlay for Display Panel */
.btn-close-modal {
    display: none;
}

@media (max-width: 1024px) {
    .btn-close-modal {
        display: block;
        background: transparent;
        border: none;
        font-size: 2.2rem;
        color: var(--text-muted);
        cursor: pointer;
        line-height: 1;
        padding: 0 0.5rem;
        transition: var(--transition-smooth);
        margin-left: auto;
    }
    
    .btn-close-modal:hover {
        color: #ef4444;
    }

    .display-panel {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(8px);
        z-index: 1000;
        align-items: center;
        justify-content: center;
        padding: 1rem;
        margin: 0;
    }
    
    .display-panel.active {
        display: flex;
    }
    
    .diploma-display {
        width: 100%;
        max-width: 580px;
        max-height: 90vh;
        overflow-y: auto;
        border-radius: var(--radius-lg);
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
        animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    @keyframes modalSlideUp {
        from { transform: translateY(30px); opacity: 0; }
        to { transform: translateY(0); opacity: 1; }
    }
    
    .pdf-viewer-container {
        aspect-ratio: 1.414; /* Keep landscape aspect ratio for A4 PDF */
        max-height: 50vh;
    }
    
    .mobile-tip {
        display: block !important;
    }
}

.mobile-tip {
    display: none;
}


