/* Custom styles for Results System - vaulting.events inspired */

/* ========================================
   CSS Variables / Color Scheme
   ======================================== */

:root {
    --color-primary-green: #04AA6D;
    --color-primary-green-hover: #038a58;
    --color-primary-blue: #1e40af;
    --color-primary-blue-hover: #1e3a8a;
    --color-live-red: #FF3333;
    --color-live-red-hover: #cc2929;
    --color-text: #333;
    --color-text-muted: #666;
    --color-border: #ddd;
    --color-bg-light: #f8f9fa;
    --color-white: #fff;
}

/* ========================================
   Base Typography
   ======================================== */

body {
    font-family: Verdana, Geneva, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-white);
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: Verdana, Geneva, sans-serif;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.9rem; }

a {
    color: var(--color-primary-blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ========================================
   Header
   ======================================== */

.site-header {
    background-color: var(--color-white);
    padding: 1rem 0;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
}

.site-logo:hover {
    color: var(--color-primary-blue);
    text-decoration: none;
}

/* ========================================
   Navigation / Breadcrumb
   ======================================== */

.breadcrumb {
    background: none;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: var(--color-primary-blue);
}

.breadcrumb-separator {
    color: var(--color-text-muted);
    margin: 0 0.5rem;
}

.event-title {
    font-size: 28px;
    font-weight: 600;
    margin: 0;
    color: var(--color-text);
}

/* ========================================
   Event Tabs Navigation
   ======================================== */

.event-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.event-tabs a {
    padding: 0.75rem 1.25rem;
    color: var(--color-text);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.event-tabs a:hover {
    color: var(--color-primary-blue);
    background-color: var(--color-bg-light);
    text-decoration: none;
}

.event-tabs a.active {
    color: var(--color-primary-blue);
    border-bottom-color: var(--color-primary-blue);
    font-weight: 600;
}

/* ========================================
   Schedule Table
   ======================================== */

.schedule-day {
    margin-bottom: 2rem;
}

.schedule-day-header {
    background-color: #4a5568;
    color: #fff;
    padding: 0.6rem 1rem;
    font-weight: 600;
    margin-bottom: 0;
    font-size: 0.95rem;
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
}

.schedule-table th,
.schedule-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.schedule-table th {
    background-color: var(--color-bg-light);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.schedule-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.schedule-time {
    width: 80px;
    white-space: nowrap;
    color: var(--color-text-muted);
    font-weight: 500;
}

.schedule-competition {
    font-weight: 500;
}

.schedule-actions {
    width: 200px;
    text-align: right;
    white-space: nowrap;
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: Verdana, Geneva, sans-serif;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

/* Green button for Results */
.btn-result {
    background-color: var(--color-primary-green);
    color: var(--color-white);
    border: 1px solid var(--color-primary-green);
}

.btn-result:hover {
    background-color: var(--color-primary-green-hover);
    color: var(--color-white);
}

/* Blue outlined button for Start Order */
.btn-action {
    background-color: transparent;
    color: var(--color-primary-blue);
    border: 1px solid var(--color-primary-blue);
}

.btn-action:hover {
    background-color: var(--color-primary-blue);
    color: var(--color-white);
}

/* Red button for Live status */
.btn-live {
    background-color: var(--color-live-red);
    color: var(--color-white);
    animation: pulse-live 2s infinite;
}

.btn-live:hover {
    background-color: var(--color-live-red-hover);
    color: var(--color-white);
}

@keyframes pulse-live {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Outline buttons */
.btn-outline {
    background-color: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.btn-outline:hover {
    background-color: var(--color-bg-light);
    color: var(--color-text);
}

/* Small buttons */
.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

/* Button group */
.btn-group {
    display: inline-flex;
    gap: 0.5rem;
}

/* ========================================
   Results Table
   ======================================== */

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.results-table th,
.results-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.results-table th {
    background-color: #333;
    color: var(--color-white);
    font-weight: 600;
    font-size: 0.85rem;
}

.results-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.results-table .rank-col {
    width: 50px;
    text-align: center;
    font-weight: 700;
}

.results-table .score-col {
    text-align: right;
    font-family: monospace;
}

.results-table .total-col {
    text-align: right;
    font-weight: 700;
    color: var(--color-primary-green);
    font-family: monospace;
}

/* Rank badges */
.rank-1 { color: #DAA520; }
.rank-2 { color: #A0A0A0; }
.rank-3 { color: #CD7F32; }

/* ========================================
   Cards (for horses, attendees)
   ======================================== */

.info-card {
    border: 1px solid var(--color-border);
    border-radius: 4px;
    margin-bottom: 1rem;
}

.info-card-header {
    background-color: var(--color-bg-light);
    padding: 0.75rem 1rem;
    font-weight: 600;
    border-bottom: 1px solid var(--color-border);
}

.info-card-body {
    padding: 0;
}

.info-card-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.info-card-list li {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--color-border);
}

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

/* ========================================
   Footer
   ======================================== */

.site-footer {
    background-color: var(--color-bg-light);
    border-top: 1px solid var(--color-border);
    padding: 1.5rem 0;
    margin-top: 3rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.site-footer a {
    color: var(--color-text-muted);
    margin: 0 0.75rem;
}

.site-footer a:hover {
    color: var(--color-primary-blue);
}

.site-footer .copyright {
    margin-top: 0.5rem;
}

/* ========================================
   Loading States
   ======================================== */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--color-text-muted);
}

.loading::before {
    content: '';
    width: 1.5rem;
    height: 1.5rem;
    margin-right: 0.75rem;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 150px;
}

.loading-spinner::after {
    content: "";
    width: 32px;
    height: 32px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========================================
   Row Update Animation
   ======================================== */

@keyframes row-flash {
    0% { background-color: rgba(4, 170, 109, 0.3); }
    100% { background-color: transparent; }
}

.row-updated {
    animation: row-flash 2s ease-out;
}

/* ========================================
   Utility Classes
   ======================================== */

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 1rem;
}

.text-muted {
    color: var(--color-text-muted);
}

.text-center {
    text-align: center;
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.py-2 { padding-top: 1rem; padding-bottom: 1rem; }
.py-3 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-4 { padding-top: 2rem; padding-bottom: 2rem; }

.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 767px) {
    .container {
        padding: 0 0.75rem;
    }

    .schedule-table th,
    .schedule-table td {
        padding: 0.5rem;
    }

    .schedule-actions {
        width: auto;
    }

    .btn-group {
        flex-direction: column;
        gap: 0.25rem;
    }

    .event-tabs a {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }

    .results-table {
        font-size: 0.8rem;
    }

    .results-table th,
    .results-table td {
        padding: 0.4rem 0.5rem;
    }
}

/* ========================================
   Bootstrap Overrides (compatibility)
   ======================================== */

/* Override Bootstrap navbar if still used */
.navbar {
    background-color: var(--color-white) !important;
    border-bottom: 1px solid var(--color-border);
}

.navbar-brand {
    color: var(--color-text) !important;
    font-weight: 600;
}

/* Override Bootstrap table */
.table {
    font-family: Verdana, Geneva, sans-serif;
}

.table-dark th {
    background-color: #333 !important;
}

/* Override Bootstrap nav-tabs */
.nav-tabs .nav-link {
    font-family: Verdana, Geneva, sans-serif;
}

.nav-tabs .nav-link.active {
    color: var(--color-primary-blue) !important;
    border-bottom-color: var(--color-primary-blue) !important;
}

/* ========================================
   Attendees Page (Teilnehmerliste)
   ======================================== */

.attendees-competition {
    margin-bottom: 2rem;
}

.attendees-header {
    margin-bottom: 0.5rem;
}

.attendees-comp-number {
    display: block;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
}

.attendees-comp-name {
    display: block;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-text);
}

.attendees-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    border: 1px solid var(--color-border);
}

.attendees-table th {
    background-color: #333;
    color: var(--color-white);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #333;
}

.attendees-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

.attendees-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.attendees-table td:first-child {
    min-width: 200px;
}

.attendees-vaulters {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
    line-height: 1.4;
}

/* Responsive adjustments for attendees */
@media (max-width: 767px) {
    .attendees-table {
        font-size: 0.8rem;
    }

    .attendees-table th,
    .attendees-table td {
        padding: 0.4rem 0.5rem;
    }

    .attendees-table td:first-child {
        min-width: auto;
    }

    .attendees-vaulters {
        font-size: 0.75rem;
    }
}
