/* Results Redesign - Styles converted from Figma/React to vanilla CSS */

/* Base page styles */
.results-page {
    min-height: 100vh;
    background: linear-gradient(to bottom right, #f9fafb, #f3f4f6);
    padding-bottom: 40px;
    margin-top: -20px; /* Compensate for br tag in _Layout.cshtml */
    padding-top: 20px; /* Restore the visual spacing inside the grey background */
}

.results-container {
    max-width: 896px;
    margin: 0 auto;
    padding: 16px;
}

@media (min-width: 768px) {
    .results-container {
        padding: 32px;
    }
}

/* Card styles */
.results-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    padding: 24px;
    margin-bottom: 24px;
}

@media (min-width: 768px) {
    .results-card {
        padding: 32px;
    }
}

/* Participant/Team header */
.results-distance-label {
    color: #4b5563;
    margin-bottom: 16px;
    font-size: 14px;
}

@media (min-width: 768px) {
    .results-distance-label {
        font-size: 16px;
    }
}

.results-distance-label span {
    font-weight: 600;
    color: #111827;
}

.results-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.results-bib {
    background-color: #111827;
    color: #ffffff;
    border-radius: 16px;
    padding: 16px;
    font-size: 30px;
    font-weight: 700;
    min-width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .results-bib {
        font-size: 36px;
        min-width: 100px;
    }
}

.results-name {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

@media (min-width: 768px) {
    .results-name {
        font-size: 36px;
    }
}

/* Categories Section */
.results-categories {
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.results-categories-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 640px) {
    .results-categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .results-categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.category-card {
    background: linear-gradient(to bottom right, #f9fafb, #f3f4f6);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #e5e7eb;
}

.category-name {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 4px;
}

.category-content {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.category-position {
    font-size: 24px;
    font-weight: 900;
    color: #111827;
}

.category-position-label {
    font-size: 14px;
    color: #4b5563;
}

.category-delta {
    text-align: right;
}

.category-delta-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.category-delta-value {
    font-size: 16px;
    font-weight: 700;
    color: #e11d48;
}

.category-medal {
    background-color: #FDB913;
    border-radius: 50%;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-medal svg {
    width: 20px;
    height: 20px;
    color: #111827;
}

/* Laps Section */
.results-laps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.lap-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.lap-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.lap-card.finish {
    box-shadow: 0 0 0 2px #FDB913, 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.lap-header {
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #111827;
}

.lap-header.finish {
    background: linear-gradient(to right, #FDB913, #FFA500);
}

.lap-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.lap-content {
    padding: 16px;
}

.lap-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

@media (min-width: 768px) {
    .lap-stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.lap-stat {
    background-color: #f9fafb;
    border-radius: 8px;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lap-stat svg {
    width: 16px;
    height: 16px;
    color: #4b5563;
    flex-shrink: 0;
}

.lap-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}

.lap-stat-value.finish {
    color: #FDB913;
}

.lap-stat-value.positive {
    color: #e11d48;
}

.lap-stat-value.negative {
    color: #059669;
}

.lap-stat-unit {
    font-size: 14px;
    color: #6b7280;
}

/* Category Results in Lap */
.lap-category-results {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
    font-size: 14px;
    flex-wrap: wrap;
}

.lap-category-result {
    display: flex;
    align-items: center;
    gap: 4px;
}

.lap-category-result-name {
    color: #6b7280;
}

.lap-category-result-position {
    font-weight: 700;
    color: #111827;
}

.lap-category-result-delta {
    font-size: 12px;
    color: #e11d48;
}

/* Mobile: category results as table-like layout */
@media (max-width: 639px) {
    .lap-category-results {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .lap-category-result {
        justify-content: space-between;
        width: 100%;
    }
}

/* Photo Gallery */
.results-gallery {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    padding: 24px;
}

@media (min-width: 768px) {
    .results-gallery {
        padding: 32px;
    }
}

.results-gallery-title {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

@media (min-width: 768px) {
    .results-gallery-title {
        font-size: 24px;
    }
}

.results-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 768px) {
    .results-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

.results-gallery-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.3s;
}

.results-gallery-item:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.results-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.results-gallery-item:hover img {
    transform: scale(1.05);
}

/* Team Members Section */
.team-members-section {
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
    margin-bottom: 24px;
}

.team-members-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.team-members-header svg {
    width: 20px;
    height: 20px;
    color: #4b5563;
}

.team-members-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.team-members-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 640px) {
    .team-members-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .team-members-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.team-member-card {
    background: linear-gradient(to bottom right, #f9fafb, #f3f4f6);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 12px;
}

.team-member-bib {
    background-color: #111827;
    color: #ffffff;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.team-member-name {
    font-weight: 600;
    color: #111827;
}

/* Team Results Section */
.team-results-section {
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

/* Mobile layout for team results */
.team-results-mobile {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

@media (min-width: 640px) {
    .team-results-mobile {
        display: none;
    }
}

.team-results-position-mobile,
.team-results-time-block-mobile,
.team-results-delta-block-mobile {
    display: flex;
    flex-direction: column;
}

.team-results-position-mobile {
    align-items: flex-start;
}

.team-results-time-block-mobile {
    align-items: center;
}

.team-results-delta-block-mobile {
    align-items: flex-end;
}

.team-results-position-label,
.team-results-final-time-label,
.team-results-delta-label {
    font-size: 12px;
    color: #4b5563;
    margin: 0 0 4px 0;
    padding: 0;
}

.team-results-position-value {
    font-size: 24px;
    font-weight: 900;
    color: #111827;
    line-height: 1;
    margin: 0;
    padding: 0;
}

.team-results-final-time {
    font-size: 24px;
    font-weight: 900;
    color: #111827;
    line-height: 1;
    margin: 0;
    padding: 0;
}

.team-results-delta {
    font-size: 20px;
    font-weight: 700;
    color: #e11d48;
    line-height: 1;
    margin: 0;
    padding: 0;
}

/* Desktop layout for team results */
.team-results-desktop {
    display: none;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

@media (min-width: 640px) {
    .team-results-desktop {
        display: flex;
    }
}

.team-results-position-desktop {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.team-results-position-desktop .label {
    font-size: 14px;
    color: #4b5563;
    margin: 0 0 4px 0;
    padding: 0;
}

.team-results-position-desktop .value {
    font-size: 36px;
    font-weight: 900;
    color: #111827;
    line-height: 1;
    margin: 0;
    padding: 0;
}

.team-results-time-desktop {
    display: flex;
    align-items: stretch;
    gap: 32px;
}

.team-results-final-time-block {
    display: flex;
    align-items: stretch;
    gap: 12px;
}

.team-results-final-time-block svg {
    width: 32px;
    height: 32px;
    color: #FDB913;
    align-self: flex-end;
}

.team-results-final-time-block .content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    height: 100%;
}

.team-results-final-time-block .content .label {
    font-size: 14px;
    color: #4b5563;
    margin: 0 0 4px 0;
    padding: 0;
}

.team-results-final-time-block .content .value {
    font-size: 36px;
    font-weight: 900;
    color: #111827;
    line-height: 1;
    margin: 0;
    padding: 0;
}

.team-results-delta-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
}

.team-results-delta-block .label {
    font-size: 14px;
    color: #4b5563;
    margin: 0 0 4px 0;
    padding: 0;
}

.team-results-delta-block .value {
    font-size: 28px;
    font-weight: 700;
    color: #e11d48;
    line-height: 1;
    margin: 0;
    padding: 0;
}

/* SVG Icons (inline styles for icons) */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon svg {
    width: 16px;
    height: 16px;
}

/* No results message */
.no-results-message {
    color: #9ca3af;
    margin-top: 20px;
    font-size: 16px;
}

/* LT Photo link */
.lt-photo-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-color: #FDB913;
    text-decoration-thickness: 2px;
    margin-bottom: 24px;
}

.lt-photo-link:hover {
    color: #b45309;
}

/* Certificate Section */
.results-top-section {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.results-info {
    flex: 1;
}

.results-certificate {
    flex-shrink: 0;
}

.certificate-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    transition: all 0.2s;
}

.certificate-link:hover {
    text-decoration: none;
}

.certificate-preview {
    max-width: 200px;
    max-height: 130px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.certificate-link:hover .certificate-preview {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(253, 185, 19, 0.4);
}

.certificate-label {
    margin-top: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    transition: transform 0.2s;
}

.certificate-link:hover .certificate-label {
    transform: scale(1.05);
}

@media (max-width: 639px) {
    .results-top-section {
        flex-direction: column;
    }

    .results-certificate {
        width: 100%;
    }

    .certificate-link {
        flex-direction: row;
        gap: 16px;
    }

    .certificate-preview {
        max-width: 120px;
        max-height: 80px;
    }

    .certificate-label {
        margin-top: 0;
    }
}
