/**
 * East Coast Surf - Game Schedule
 * Main Stylesheet
 */

/* ============ Base Styles ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    min-height: 100vh;
}

body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ============ Header ============ */
.header {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f2744 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.header p {
    opacity: 0.8;
    font-size: 14px;
}

/* ============ Container & Layout ============ */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.toolbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.filters-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.buttons-row {
    display: flex;
    gap: 8px;
}

/* ============ Filters & Buttons ============ */
.filter-select {
    flex: 1;
    min-width: 100px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    color: #1e293b;
}

.filter-select:focus {
    outline: none;
    border-color: #1e3a5f;
}

.add-btn {
    flex: 1;
    background: #1e3a5f;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.add-btn:hover {
    background: #0f2744;
}

.add-btn.secondary {
    background: white;
    color: #1e3a5f;
    border: 2px solid #1e3a5f;
}

.add-btn.secondary:hover {
    background: #f1f5f9;
}

/* ============ Game Cards - Timeline Style ============ */
.weekend-section {
    margin-bottom: 32px;
}

.weekend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 16px;
    padding: 8px 0;
    border-bottom: 2px solid #e2e8f0;
    gap: 12px;
}

.weekend-header.is-weekend {
    border-bottom-color: #1e3a5f;
}

.location-filter {
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    color: #475569;
    cursor: pointer;
    max-width: 180px;
}

.location-filter:focus {
    outline: none;
    border-color: #1e3a5f;
}

.games-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-left: 3px solid #e2e8f0;
    margin-left: 8px;
    padding-left: 20px;
}

.game-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #f1f5f9;
    position: relative;
}

.game-card::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 22px;
    width: 10px;
    height: 10px;
    background: #1e3a5f;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 2px #e2e8f0;
}

.game-card:last-child {
    border-bottom: none;
}

.game-time {
    font-size: 18px;
    font-weight: 700;
    color: #1e3a5f;
    min-width: 75px;
    line-height: 1.2;
}

.game-time .ampm {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
}

.game-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.game-team {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
}

.game-opponent {
    font-size: 15px;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 8px;
}

.home-away {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.home-away.home {
    background: #dcfce7;
    color: #166534;
}

.home-away.away {
    background: #fef3c7;
    color: #92400e;
}

.game-location {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 2px;
}

.game-location a {
    color: #2563eb;
    text-decoration: none;
}

.game-actions {
    display: flex;
    align-self: center;
}

.game-actions .btn-group {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.game-actions .action-btn {
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: white;
    color: #475569;
    transition: all 0.15s;
    border-right: 1px solid #e2e8f0;
}

.game-actions .action-btn:last-child {
    border-right: none;
}

.game-actions .action-btn:hover {
    background: #f8fafc;
}

.game-actions .action-btn:active {
    background: #f1f5f9;
}

.game-actions .action-btn.assign {
    color: #1e3a5f;
}

.game-actions .action-btn.assign:hover {
    background: #eff6ff;
}

.game-actions .action-btn.edit {
    color: #475569;
}

.game-actions .action-btn.delete {
    color: #dc2626;
}

.game-actions .action-btn.delete:hover {
    background: #fef2f2;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.empty-state h3 {
    margin-bottom: 8px;
}

/* ============ Modals ============ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.modal {
    background: white;
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 450px;
    margin: 20px auto;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
}

/* ============ Forms ============ */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px;
    background: white;
    -webkit-appearance: none;
    appearance: none;
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #1e3a5f;
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.time-selects {
    display: flex;
    gap: 8px;
}

.time-selects select {
    flex: 1;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    background: white;
}

.time-selects select:first-child {
    flex: 2;
}

/* ============ Toggle & Checkbox Groups ============ */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.toggle-group {
    display: flex;
    gap: 8px;
}

.toggle-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn.active {
    border-color: #1e3a5f;
    background: #1e3a5f;
    color: white;
}

/* ============ Venue Buttons ============ */
.venue-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.venue-btn {
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.venue-btn:hover {
    border-color: #1e3a5f;
}

.venue-btn.selected {
    border-color: #1e3a5f;
    background: #1e3a5f;
    color: white;
}

.venue-btn .venue-name {
    font-weight: 600;
}

.venue-btn .venue-address {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
}

.venue-btn.add-field-inline-btn {
    border-style: dashed;
    background: #f8fafc;
}

.venue-btn.add-field-inline-btn:hover {
    background: #f1f5f9;
}

.inline-add-field-form {
    padding: 16px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

/* ============ Fields Manager ============ */
.fields-list {
    margin-bottom: 24px;
}

.field-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    background: #f8fafc;
    border-radius: 10px;
    margin-bottom: 10px;
}

.field-info {
    flex: 1;
}

.field-name {
    font-weight: 600;
    color: #1e293b;
}

.field-address {
    font-size: 13px;
    color: #64748b;
    margin-top: 2px;
}

.field-actions {
    display: flex;
    gap: 8px;
}

.field-actions button {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    border: none;
}

.field-edit-btn {
    background: #e2e8f0;
    color: #475569;
}

.field-delete-btn {
    background: #fee2e2;
    color: #dc2626;
}

.add-field-form {
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.add-field-form h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1e293b;
}

.add-field-btn {
    width: 100%;
    padding: 14px;
    background: #1e3a5f;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.add-field-btn:hover {
    background: #0f2744;
}

.empty-fields {
    text-align: center;
    padding: 24px;
    color: #64748b;
    background: #f8fafc;
    border-radius: 10px;
}

/* ============ Opponent Autocomplete ============ */
.opponent-autocomplete-wrapper {
    position: relative;
}

.opponent-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 4px;
}

.opponent-option {
    padding: 12px 14px;
    cursor: pointer;
    font-size: 15px;
    border-bottom: 1px solid #f1f5f9;
}

.opponent-option:last-child {
    border-bottom: none;
}

.opponent-option:hover, .opponent-option:active {
    background: #f1f5f9;
}

/* ============ Modal Actions ============ */
.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
}

.modal-actions .primary-row {
    display: flex;
    gap: 10px;
}

.modal-actions button {
    padding: 14px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

.cancel-btn {
    background: #f1f5f9;
    color: #475569;
    flex: 1;
}

.save-btn {
    background: #1e3a5f;
    color: white;
    flex: 2;
}

.save-another-btn {
    background: white;
    color: #1e3a5f;
    border: 2px solid #1e3a5f !important;
    width: 100%;
}

.save-another-btn:hover {
    background: #f8fafc;
}

/* ============ Toast Notification ============ */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #166534;
    color: white;
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    z-index: 3000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast-icon {
    font-size: 18px;
}

/* ============ Upload Schedule ============ */
.upload-zone {
    border: 2px dashed #e2e8f0;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #f8fafc;
}

.upload-zone:hover {
    border-color: #1e3a5f;
    background: #f1f5f9;
}

.upload-zone.dragging {
    border-color: #1e3a5f;
    background: #e8f4fd;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.upload-text {
    font-size: 16px;
    color: #64748b;
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 13px;
    color: #94a3b8;
}

.upload-preview {
    margin-top: 16px;
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    display: none;
}

.processing-indicator {
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #1e3a5f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.processing-text {
    margin-top: 16px;
    font-size: 15px;
    color: #64748b;
}

/* ============ Parsed Games Preview ============ */
.parsed-games-list {
    max-height: 400px;
    overflow-y: auto;
}

.parsed-game-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 8px;
}

.parsed-game-item.has-issue {
    background: #fef3c7;
    border: 1px solid #f59e0b;
}

.parsed-game-checkbox {
    width: 20px;
    height: 20px;
}

.parsed-game-info {
    flex: 1;
}

.parsed-game-main {
    font-weight: 600;
    margin-bottom: 4px;
}

.parsed-game-meta {
    font-size: 13px;
    color: #64748b;
}

.parsed-game-issue {
    font-size: 12px;
    color: #b45309;
    margin-top: 4px;
}

.parsed-game-team-select {
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    background: white;
}

.import-summary {
    background: #f1f5f9;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.import-summary strong {
    color: #1e3a5f;
}

/* ============ iOS-style Picker ============ */
.picker-input {
    display: none;
}

.picker-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.picker-overlay.show {
    display: flex;
}

.picker-container {
    background: #f2f2f7;
    width: 90%;
    max-width: 360px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f9f9f9;
    border-bottom: 1px solid #e5e5e5;
}

.picker-header button {
    background: none;
    border: none;
    font-size: 17px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
}

.picker-cancel {
    color: #007aff;
}

.picker-done {
    color: #007aff;
    font-weight: 600;
}

.picker-title {
    font-size: 15px;
    font-weight: 600;
    color: #1c1c1e;
}

.picker-wheels {
    display: flex;
    height: 220px;
    position: relative;
    background: white;
}

.picker-wheel {
    flex: 1;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.picker-wheel::-webkit-scrollbar {
    display: none;
}

.picker-wheel-inner {
    padding: 88px 0;
}

.picker-item {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    scroll-snap-align: center;
    color: #1c1c1e;
    padding: 0 8px;
}

.picker-item.weekend {
    background: #f1f5f9;
    font-weight: 600;
}

.picker-selection {
    position: absolute;
    top: 50%;
    left: 8px;
    right: 8px;
    height: 44px;
    transform: translateY(-50%);
    border-top: 1px solid #c6c6c8;
    border-bottom: 1px solid #c6c6c8;
    pointer-events: none;
}

/* ============ Google Places Autocomplete ============ */
.pac-container {
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border: none;
    margin-top: 4px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    z-index: 100000 !important;
    background: white;
    max-width: calc(100vw - 40px);
    max-height: 200px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.pac-item {
    padding: 14px 16px;
    cursor: pointer;
    font-size: 15px;
    border-bottom: 1px solid #f1f5f9;
}

.pac-item:last-child {
    border-bottom: none;
}

.pac-item:hover, .pac-item:active {
    background: #f1f5f9;
}

.pac-item-query {
    font-weight: 600;
}

/* ============ League Filter Pills ============ */
.league-filter-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.league-pill {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.league-pill:hover {
    border-color: #1e3a5f;
}

.league-pill.active {
    background: #1e3a5f;
    color: white;
    border-color: #1e3a5f;
}

/* ============ Desktop Inputs ============ */
.desktop-input {
    display: block;
}

/* ============ Mobile Responsive ============ */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 0;
        align-items: flex-start;
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal {
        border-radius: 0;
        min-height: 100vh;
        padding-bottom: 350px;
    }
    
    #gameLocation {
        font-size: 16px;
    }
    
    .pac-container {
        position: fixed !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-height: 180px;
        bottom: auto !important;
    }
    
    .desktop-input {
        display: none !important;
    }
    
    .picker-input {
        display: block;
        width: 100%;
        padding: 12px;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        font-size: 16px;
        background: white;
        cursor: pointer;
        text-align: center;
        font-weight: 500;
        color: #1e293b;
    }
    
    .picker-input.placeholder {
        color: #94a3b8;
    }
    
    .game-card {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .game-time {
        min-width: 65px;
        font-size: 16px;
    }
    
    .game-main {
        flex: 1;
        min-width: 150px;
    }
    
    .game-actions {
        width: 100%;
        justify-content: flex-end;
        padding-top: 10px;
        border-top: 1px solid #f1f5f9;
    }
    
    .game-actions .action-btn {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .games-grid {
        margin-left: 4px;
        padding-left: 16px;
    }
    
    .game-card::before {
        left: -19px;
        width: 8px;
        height: 8px;
    }
    
    .filters-row {
        flex-direction: column;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .buttons-row {
        flex-direction: column;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}
