@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Roboto+Condensed:wght@700&display=swap');

:root {
    --fd-font-primary: 'Inter', sans-serif;
    --fd-font-display: 'Roboto Condensed', sans-serif;

    --fd-primary: #007BFF;
    --fd-primary-rgb: 0, 123, 255;
    --fd-primary-dark: #0056b3;
    --fd-secondary: #6c757d;
    --fd-success: #28a745;
    --fd-danger: #dc3545;
    --fd-warning: #ffc107;
    --fd-info: #17a2b8;
    --fd-light: #f8f9fa;
    --fd-dark: #343a40;
    --fd-white: #ffffff;
    --fd-grey-100: #f8f9fa;
    --fd-grey-200: #e9ecef;
    --fd-grey-300: #dee2e6;
    --fd-grey-400: #ced4da;
    --fd-grey-500: #adb5bd;
    --fd-grey-600: #6c757d;
    --fd-grey-700: #495057;
    --fd-grey-800: #343a40;
    --fd-grey-900: #212529;

    --fd-bg-color: var(--fd-grey-100);
    --fd-text-color: var(--fd-grey-800);
    --fd-card-bg: var(--fd-white);
    --fd-border-color: var(--fd-grey-300);
    --fd-border-radius: 12px;
    --fd-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
    --fd-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: var(--fd-font-primary);
    color: var(--fd-text-color);
    background-color: var(--fd-bg-color);
}

.footy-doubles-container {
    max-width: 1040px; /* Increased width to accommodate a ~1000px table */
    margin: 40px auto;
    padding: 20px;
    font-family: var(--fd-font-primary);
    position: relative;
    overflow: hidden;
}

.footy-doubles-container h2,
.footy-doubles-container h3,
.footy-doubles-container h4 {
    font-family: var(--fd-font-display);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--fd-dark);
}

.footy-doubles-container h2 {
    font-size: 2.5rem;
    margin-bottom: 24px;
    text-align: center;
}

.footy-doubles-container h3 {
    font-size: 1.75rem;
    margin-bottom: 16px;
}

.footy-doubles-container h4 {
    font-size: 1.25rem;
    margin-bottom: 12px;
}

.fd-how-to-play {
    background: var(--fd-card-bg);
    padding: 24px;
    margin-bottom: 30px;
    border-radius: var(--fd-border-radius);
    box-shadow: var(--fd-shadow);
    border-left: 5px solid var(--fd-primary);
}

.fd-how-to-play-note {
    color: var(--fd-secondary);
    font-size: 0.9em;
}

.fd-games-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--fd-card-bg);
    border-radius: var(--fd-border-radius);
    overflow: hidden;
    box-shadow: var(--fd-shadow-lg);
}

.fd-games-table th,
.fd-games-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--fd-border-color);
    vertical-align: middle; /* Use standard table vertical alignment */
}

.fd-games-table td:last-child {
    text-align: right;
}

.fd-games-table th {
    background-color: var(--fd-grey-200);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--fd-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.fd-games-table tr {
    transition: background-color 0.2s ease-in-out;
}

.fd-games-table tr:hover {
    background-color: rgba(var(--fd-primary-rgb), 0.05);
}

.fd-games-table tr:last-child td {
    border-bottom: none;
}

.fd-team {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    vertical-align: middle; /* Explicitly align to middle */
}

.fd-team-chip {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--fd-white);
    box-shadow: 0 0 0 2px var(--fd-border-color);
}

.fd-team-vs {
    margin: 0 10px;
    color: var(--fd-secondary);
    font-weight: 700;
    font-family: var(--fd-font-display);
    vertical-align: middle; /* Explicitly align to middle */
}

.fd-selected-game {
    animation: fd-fade-in 0.5s ease-out;
}

.fd-game-card {
    background: var(--fd-card-bg);
    padding: 30px;
    margin-bottom: 30px;
    border-radius: var(--fd-border-radius);
    box-shadow: var(--fd-shadow-lg);
}

.fd-live-stats {
    margin: 24px 0;
    padding: 20px;
    background-color: var(--fd-grey-100);
    border-radius: var(--fd-border-radius);
    border: 1px solid var(--fd-border-color);
}

.fd-live-metrics {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    margin-bottom: 20px;
}

.fd-live-metric {
    text-align: center;
}

.fd-live-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--fd-secondary);
    font-weight: 600;
    margin-bottom: 6px;
}

.fd-live-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--fd-dark);
}

.fd-progress {
    display: flex;
    align-items: center;
    gap: 15px;
}

.fd-progress-bar {
    flex: 1;
    height: 12px;
    background: var(--fd-grey-300);
    border-radius: 999px;
    overflow: hidden;
}

.fd-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--fd-info) 0%, var(--fd-primary) 100%);
    transition: width 0.5s ease;
}

.fd-progress-text {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--fd-dark);
}

.fd-sales-closed {
    margin-top: 15px;
    padding: 12px 15px;
    background: rgba(var(--fd-danger-rgb), 0.1);
    border: 1px solid rgba(var(--fd-danger-rgb), 0.2);
    color: var(--fd-danger);
    border-radius: var(--fd-border-radius);
    font-weight: 600;
    text-align: center;
}

.fd-purchase-box {
    margin-top: 30px;
    padding: 24px;
    background-color: var(--fd-grey-100);
    border-radius: var(--fd-border-radius);
}

.fd-purchase-form .regular-text {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--fd-border-color);
    border-radius: 8px;
    font-family: var(--fd-font-primary);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.fd-purchase-form .regular-text:focus {
    outline: none;
    border-color: var(--fd-primary);
    box-shadow: 0 0 0 3px rgba(var(--fd-primary-rgb), 0.2);
}

.fd-purchase-form p {
    margin-bottom: 15px;
}

.fd-purchase-form label {
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
}

.fd-spinner {
    display: none;
    margin-left: 10px;
    vertical-align: middle;
}

.fd-no-games {
    padding: 60px 40px;
    text-align: center;
    background: var(--fd-card-bg);
    border-radius: var(--fd-border-radius);
    box-shadow: var(--fd-shadow);
}

.button, .fd-purchase-btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-family: var(--fd-font-primary);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
}

.button-primary, .fd-purchase-btn {
    background-color: var(--fd-primary);
    color: var(--fd-white);
    box-shadow: 0 4px 12px rgba(var(--fd-primary-rgb), 0.2);
}

.button-primary:hover, .fd-purchase-btn:hover {
    background-color: var(--fd-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(var(--fd-primary-rgb), 0.3);
}

.button.fd-back-to-list {
    background-color: transparent;
    color: var(--fd-primary);
    box-shadow: none;
    padding-left: 0;
}
.button.fd-back-to-list:hover {
    background-color: transparent;
    color: var(--fd-primary-dark);
    transform: translateX(-2px);
}

#fd-success-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(var(--fd-dark-rgb), 0.6);
    z-index: 100000;
    display: flex; /* Use flexbox for centering */
    align-items: center; /* Vertically center */
    justify-content: center; /* Horizontally center */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
    padding: 20px; /* Add padding around the modal */
    box-sizing: border-box; /* Include padding in width/height */
}

#fd-success-modal.fd-modal-visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

.fd-modal-content {
    background: var(--fd-white);
    padding: 40px;
    border-radius: var(--fd-border-radius);
    max-width: 620px;
    width: 90%; /* Responsive width */
    box-shadow: var(--fd-shadow-lg);
    transition: transform 0.3s ease;
    box-sizing: border-box;
    transform: scale(0.95);
    max-height: calc(100vh - 40px); /* Limit height to viewport and padding */
    overflow-y: auto; /* Enable internal scrolling if content overflows */
    margin: auto; /* Fallback for centering within flex parent */
}

#fd-success-modal.fd-modal-visible .fd-modal-content {
    transform: scale(1);
}

.fd-modal-title {
    color: var(--fd-success);
    font-size: 2rem;
    text-align: center;
    margin-bottom: 20px;
}

.fd-modal-close {
    margin-top: 30px;
    display: block;
    width: 100%;
}

.fd-success-icon {
    margin-bottom: 20px;
    text-align: center;
}

.fd-success-icon svg {
    width: 80px;
    height: 80px;
}

.fd-success-grid {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

.fd-success-card {
    border: 1px solid var(--fd-border-color);
    border-radius: var(--fd-border-radius);
    overflow: hidden;
    background: var(--fd-white);
}

.fd-success-card-head {
    background: var(--fd-grey-100);
    padding: 12px 16px;
    font-weight: 700;
    color: var(--fd-dark);
}

.fd-success-card-body {
    padding: 16px;
    display: grid;
    gap: 12px;
}

.fd-success-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.fd-success-label {
    font-size: 0.8rem;
    color: var(--fd-secondary);
    font-weight: 500;
}

.fd-success-value {
    font-weight: 600;
    text-align: right;
}

.fd-number-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    justify-content: flex-end;
}

.fd-number-chip {
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(var(--fd-primary-rgb), 0.1);
    color: var(--fd-primary);
    font-weight: 700;
    font-size: 0.9rem;
}

.fd-success-total-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-radius: var(--fd-border-radius);
    background: rgba(var(--fd-success-rgb), 0.1);
    color: var(--fd-success);
    font-weight: 700;
    font-size: 1.1rem;
    margin-top: 20px;
}

.fd-success-email-note {
    font-size: 0.9em;
    color: var(--fd-secondary);
    text-align: center;
    margin-top: 20px;
}

.fd-field-error {
    color: var(--fd-danger);
    font-size: 0.85em;
    margin-top: 6px;
}

.fd-field-has-error {
    border-color: var(--fd-danger) !important;
}

.fd-error-message {
    background: rgba(var(--fd-danger-rgb), 0.1);
    border-left: 4px solid var(--fd-danger);
    padding: 15px;
    margin: 20px 0;
    border-radius: 3px;
    color: var(--fd-danger);
    font-weight: 500;
}

.fd-hidden {
    display: none !important;
}

@keyframes fd-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .footy-doubles-container {
        padding: 15px;
        margin: 20px auto;
    }

    .footy-doubles-container h2 {
        font-size: 2rem;
    }
    
    .fd-games-table {
        display: block;
        width: 100%;
    }
    .fd-games-table thead {
        display: none;
    }
    .fd-games-table tbody,
    .fd-games-table tr,
    .fd-games-table td {
        display: block;
        width: 100%;
        text-align: left;
    }

    .fd-games-table tr {
        margin-bottom: 15px;
        border-radius: var(--fd-border-radius);
        box-shadow: var(--fd-shadow);
        border: 1px solid var(--fd-border-color);
        overflow: hidden;
    }

    .fd-games-table td {
        padding: 12px 15px;
        border-bottom: 1px solid var(--fd-border-color);
        position: relative;
        padding-left: 120px;
    }

    .fd-games-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        width: 90px;
        font-weight: 600;
        text-transform: uppercase;
        font-size: 0.75rem;
        color: var(--fd-grey-600);
    }
    .fd-games-table td:last-child {
        border-bottom: none;
    }
}
