/**
 * Event Tracker - Frontend Styles
 * Based on Tailwind CSS design system
 * Spacing: 4px base unit (4, 8, 12, 16, 20, 24, 32, 40, 48)
 * Typography: 12, 14, 16, 18, 20, 24px
 */

/* =========================================================================
   EVENT LIST
   ========================================================================= */

.et-event-list {
    margin: 24px 0;
}

.et-event-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
    gap: 24px !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Event Card */
.et-event-card {
    display: block !important;
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    transition: box-shadow 0.2s ease;
    float: none !important;
    width: auto !important;
}

.et-event-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.et-event-card-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: #f3f4f6;
}

.et-event-card-content {
    padding: 16px;
}

.et-event-card-title {
    margin: 8px 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}

.et-event-card-title a {
    color: #111827;
    text-decoration: none;
}

.et-event-card-title a:hover {
    color: #4f46e5;
}

.et-event-card-meta {
    color: #6b7280;
    font-size: 14px;
    line-height: 1.5;
}

.et-event-card-meta span {
    display: block;
}

/* =========================================================================
   STATUS BADGES
   ========================================================================= */

.et-status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.et-status-registered {
    background: #dbeafe;
    color: #1d4ed8;
}

.et-status-completed {
    background: #dcfce7;
    color: #15803d;
}

.et-status-dns {
    background: #fef3c7;
    color: #b45309;
}

.et-status-dnf {
    background: #fce7f3;
    color: #be185d;
}

.et-status-cancelled {
    background: #f3f4f6;
    color: #6b7280;
}

/* =========================================================================
   SINGLE EVENT VIEW
   ========================================================================= */

.et-event-single {
    max-width: 720px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #111827;
}

/* Reset theme spacing and typography */
.et-event-single *,
.et-event-single *::before,
.et-event-single *::after {
    box-sizing: border-box;
}

.et-event-single h1,
.et-event-single h2,
.et-event-single h3,
.et-event-single h4,
.et-event-single p,
.et-event-single ul,
.et-event-single li,
.et-event-single div,
.et-event-single span {
    margin: 0;
    padding: 0;
    font-family: inherit;
    line-height: inherit;
}

.et-event-single ul {
    list-style: none;
}

/* Back Link */
.et-back-link {
    margin-bottom: 16px;
}

.et-back-link a {
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.15s ease;
}

.et-back-link a:hover {
    color: #111827;
}

/* Event Header */
.et-event-header {
    margin-bottom: 24px;
}

.et-event-header .et-status-badge {
    margin-bottom: 8px;
}

.et-event-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #111827;
    line-height: 1.25;
}

.et-event-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.5;
}

/* Event Photo */
.et-event-photo {
    width: 100%;
    max-width: 480px;
    height: auto;
    border-radius: 8px;
    margin-bottom: 32px;
}

/* Event Sections */
.et-event-section {
    margin-bottom: 32px;
    padding: 20px 24px;
    background: #f9fafb;
    border-radius: 8px;
}

.et-event-section h2 {
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.et-event-description {
    line-height: 1.625;
    color: #374151;
    font-size: 14px;
}

.et-event-description p {
    margin-bottom: 12px;
}

.et-event-description p:last-child {
    margin-bottom: 0;
}

/* Event Links */
.et-event-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.et-event-links a {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: #4f46e5;
    color: #ffffff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s ease;
}

.et-event-links a:hover {
    background: #4338ca;
}

/* =========================================================================
   RESULTS SECTION
   ========================================================================= */

.et-results-section {
    margin-bottom: 32px;
}

.et-results-section > h2 {
    margin-bottom: 16px;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

/* Participant Result Card */
.et-participant-result {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 16px;
}

.et-participant-result:last-child {
    margin-bottom: 0;
}

.et-participant-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
    color: #111827;
}

/* Race Result */
.et-race-result {
    margin-bottom: 20px;
}

.et-race-result:last-child {
    margin-bottom: 0;
}

.et-race-result.et-multi-race {
    padding: 16px 20px;
    background: #f9fafb;
    border-radius: 6px;
    border-left: 3px solid #4f46e5;
}

.et-race-type-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #374151;
}

/* Result Stats Grid */
.et-result-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.et-result-stat {
    text-align: center;
    padding: 12px 16px;
    background: #f3f4f6;
    border-radius: 6px;
    min-width: 80px;
}

.et-result-stat-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
}

.et-result-stat-label {
    display: block;
    font-size: 11px;
    color: #6b7280;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Placement Badges */
.et-result-placements {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.et-placement-badge {
    display: inline-block;
    padding: 6px 12px;
    background: #f3f4f6;
    color: #374151;
    border-radius: 6px;
    font-size: 13px;
}

/* Result Links */
.et-result-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.et-result-links a {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: #4f46e5;
    color: #ffffff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s ease;
}

.et-result-links a:hover {
    background: #4338ca;
}

/* Result Images */
.et-result-images {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.et-result-image-item {
    text-align: center;
}

.et-result-image-item img {
    max-width: 160px;
    height: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    transition: opacity 0.15s ease;
}

.et-result-image-item img:hover {
    opacity: 0.8;
}

.et-result-image-label {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #6b7280;
}

/* =========================================================================
   EMPTY STATE
   ========================================================================= */

.et-empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #6b7280;
    font-size: 14px;
}

/* =========================================================================
   COMPACT LIST LAYOUT
   ========================================================================= */

.et-layout-compact .et-compact-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.et-layout-compact .et-compact-item {
    border-bottom: 1px solid #e5e7eb;
}

.et-layout-compact .et-compact-item:last-child {
    border-bottom: none;
}

.et-layout-compact .et-compact-link {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
}

.et-layout-compact .et-compact-link:hover {
    background: #f9fafb;
    margin: 0 -12px;
    padding: 16px 12px;
}

.et-layout-compact .et-compact-date {
    min-width: 100px;
    color: #6b7280;
    font-size: 14px;
}

.et-layout-compact .et-compact-name {
    flex: 1;
    font-weight: 600;
    color: #4f46e5;
    font-size: 14px;
}

.et-layout-compact .et-compact-link:hover .et-compact-name {
    text-decoration: underline;
}

.et-layout-compact .et-compact-location {
    color: #9ca3af;
    font-size: 14px;
}

/* =========================================================================
   TABLE LAYOUT
   ========================================================================= */

.et-layout-table .et-events-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    font-size: 14px;
}

.et-layout-table .et-events-table th,
.et-layout-table .et-events-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.et-layout-table .et-events-table th {
    background: #f9fafb;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
}

.et-layout-table .et-events-table tbody tr:hover {
    background: #f9fafb;
}

.et-layout-table .et-events-table tbody tr:last-child td {
    border-bottom: none;
}

.et-layout-table .et-table-name a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
}

.et-layout-table .et-table-name a:hover {
    text-decoration: underline;
}

.et-layout-table .et-table-date {
    white-space: nowrap;
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */

@media screen and (max-width: 640px) {
    .et-event-grid {
        grid-template-columns: 1fr;
    }

    .et-event-title {
        font-size: 20px;
    }

    .et-event-meta {
        flex-direction: column;
        gap: 4px;
    }

    .et-event-photo {
        max-width: 100%;
    }

    .et-event-section {
        padding: 16px 20px;
    }

    .et-participant-result {
        padding: 16px 20px;
    }

    .et-result-stat {
        min-width: 70px;
        padding: 10px 12px;
    }

    .et-result-stat-value {
        font-size: 16px;
    }

    .et-layout-compact .et-compact-link {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .et-layout-compact .et-compact-date {
        min-width: auto;
    }

    .et-layout-table .et-events-table {
        display: block;
        overflow-x: auto;
    }
}

/* =========================================================================
   PARTICIPANT RESULTS - SHARED STYLES
   ========================================================================= */

.et-participant-results {
    margin: 24px 0;
}

.et-participant-stats {
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 14px;
    color: #374151;
}

.et-participant-stats .et-stat {
    margin-right: 20px;
}

.et-participant-stats .et-stat strong {
    color: #111827;
    font-size: 18px;
}

.et-error {
    padding: 16px;
    background: #fef2f2;
    color: #b91c1c;
    border-radius: 6px;
    font-size: 14px;
}

.et-empty {
    padding: 32px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

/* =========================================================================
   PARTICIPANT RESULTS - LIST VIEW
   ========================================================================= */

.et-participant-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    font-size: 13px;
}

.et-participant-table th,
.et-participant-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.et-participant-table th {
    background: #f9fafb;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    white-space: nowrap;
}

.et-participant-table tbody tr:hover {
    background: #f9fafb;
}

.et-participant-table tbody tr:last-child td {
    border-bottom: none;
}

.et-participant-table .et-event-link {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
}

.et-participant-table .et-event-link:hover {
    text-decoration: underline;
}

.et-participant-table .et-col-event {
    min-width: 180px;
}

.et-participant-table .et-col-date {
    white-space: nowrap;
    color: #6b7280;
}

.et-participant-table .et-col-race .et-race-type {
    display: inline-block;
    padding: 2px 8px;
    background: #eef2ff;
    color: #4f46e5;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.et-participant-table .et-col-time strong {
    color: #111827;
}

.et-participant-table .et-col-pace {
    color: #6b7280;
}

.et-participant-table .et-col-place .et-place {
    font-weight: 600;
    color: #111827;
}

.et-participant-table .et-col-place .et-place-total {
    color: #9ca3af;
    font-size: 11px;
}

.et-participant-table .et-col-place .et-place-pct {
    color: #6b7280;
    font-size: 11px;
}

.et-participant-table .et-no-data {
    color: #d1d5db;
}

.et-participant-table .et-status-badge {
    margin-left: 8px;
    padding: 1px 6px;
    font-size: 10px;
}

.et-result-row-dns,
.et-result-row-dnf,
.et-result-row-cancelled {
    opacity: 0.6;
}

/* =========================================================================
   PARTICIPANT RESULTS - GRID VIEW
   ========================================================================= */

.et-participant-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.et-participant-grid .et-participant-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.et-participant-grid .et-participant-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.et-participant-grid .et-participant-card.et-status-dns,
.et-participant-grid .et-participant-card.et-status-dnf,
.et-participant-grid .et-participant-card.et-status-cancelled {
    opacity: 0.7;
}

.et-participant-grid .et-card-image {
    display: block;
}

.et-participant-grid .et-card-image img {
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.et-participant-grid .et-card-content {
    padding: 16px;
}

.et-participant-grid .et-card-header {
    margin-bottom: 8px;
}

.et-participant-grid .et-card-title {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    text-decoration: none;
    line-height: 1.3;
}

.et-participant-grid .et-card-title:hover {
    color: #4f46e5;
}

.et-participant-grid .et-card-meta {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 12px;
}

.et-participant-grid .et-card-meta .et-separator {
    margin: 0 6px;
}

.et-participant-grid .et-card-meta .et-race-type {
    color: #4f46e5;
    font-weight: 500;
}

.et-participant-grid .et-card-time {
    margin-bottom: 12px;
    padding: 10px;
    background: #f9fafb;
    border-radius: 6px;
    text-align: center;
}

.et-participant-grid .et-time-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.et-participant-grid .et-pace-value {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.et-participant-grid .et-card-placements {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.et-participant-grid .et-placement {
    flex: 1;
    min-width: 80px;
    padding: 8px;
    background: #f3f4f6;
    border-radius: 6px;
    text-align: center;
}

.et-participant-grid .et-placement-label {
    display: block;
    font-size: 10px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.et-participant-grid .et-placement-value {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #111827;
}

.et-participant-grid .et-placement-value .et-of {
    font-weight: 400;
    color: #9ca3af;
    font-size: 11px;
}

.et-participant-grid .et-placement-bar {
    height: 3px;
    background: #e5e7eb;
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

.et-participant-grid .et-placement-fill {
    height: 100%;
    background: #4f46e5;
    border-radius: 2px;
}

.et-participant-grid .et-status-badge {
    margin-top: 6px;
    font-size: 10px;
}

/* =========================================================================
   PARTICIPANT RESULTS - RESPONSIVE
   ========================================================================= */

@media screen and (max-width: 768px) {
    .et-participant-table {
        display: block;
        overflow-x: auto;
    }

    .et-participant-cards {
        grid-template-columns: 1fr;
    }
}

/* =========================================================================
   PERSONAL BESTS
   ========================================================================= */

.et-personal-bests {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.et-pb-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 16px 0;
}

.et-pb-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.et-pb-card {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 16px;
    min-width: 160px;
    flex: 0 1 auto;
}

.et-pb-event-type {
    font-size: 12px;
    font-weight: 600;
    color: #92400e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.et-pb-time {
    font-size: 24px;
    font-weight: 700;
    color: #78350f;
    line-height: 1.2;
}

.et-pb-pace {
    font-size: 13px;
    color: #92400e;
    margin-top: 2px;
}

.et-pb-event {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(245, 158, 11, 0.3);
}

.et-pb-event a {
    font-size: 13px;
    color: #78350f;
    text-decoration: none;
    display: block;
    line-height: 1.3;
}

.et-pb-event a:hover {
    text-decoration: underline;
}

.et-pb-date {
    font-size: 12px;
    color: #92400e;
    display: block;
    margin-top: 2px;
}

@media screen and (max-width: 480px) {
    .et-pb-cards {
        flex-direction: column;
    }

    .et-pb-card {
        min-width: auto;
        width: 100%;
    }
}
