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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.main-header {
    background: #2c4991;
    color: white;
    padding: 0.2rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: visible;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

/* Spotlight effect directly above logo - follows logo position dynamically */
.main-header {
    --spotlight-x: 140px; /* Default position, updated by JavaScript */
}

.main-header::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    /* Spotlight: elliptical gradient from top, positioned at logo's right edge */
    background: radial-gradient(ellipse 400px 180px at var(--spotlight-x) 0%, rgba(255, 255, 255, 0.25), transparent 75%);
    pointer-events: none;
    z-index: 0;
}

/* Additional subtle spotlight for depth */
.main-header::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: radial-gradient(ellipse 350px 150px at var(--spotlight-x) -5%, rgba(255, 255, 255, 0.50), transparent 100%);
    pointer-events: none;
    z-index: 0;
}

.logo {
    position: relative;
    z-index: 1;
}


.main-header > * {
    position: relative;
    z-index: 1;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 1.5rem;
    margin: 0;
}

.logo a {
    color: white;
    text-decoration: none;
}

.main-nav {
    position: relative;
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    align-items: center;
}

/* Hamburger menu button (hidden by default) */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.mobile-menu-toggle span {
    width: 100%;
    height: 3px;
    background: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
}

.main-nav a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}

.main-nav a:hover {
    color: #a5f3fc;
}

.user-menu {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e0e0e0;
}

.page-header h1 {
    color: #2c3e50;
    font-size: 2rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: #3498db;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #2980b9;
}

.btn-primary {
    background-color: #3498db;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-danger {
    background-color: #e74c3c;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-book {
    background-color: #27ae60;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
}

.btn-book:hover {
    background-color: #229954;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.password-field {
    position: relative;
}
.password-field .pw-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0;
    color: #666;
    opacity: 0.8;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
}
.password-field .pw-toggle:hover { opacity: 1; color: #2c3e50; }
.password-field .pw-toggle svg { display: block; }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

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

/* Auth Container */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-box {
    background: white;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 450px;
}

.auth-box h1 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    text-align: center;
}

.auth-links {
    margin-top: 1.5rem;
    text-align: center;
}

.auth-links a {
    color: #3498db;
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Inline links in login modal */
.auth-links-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    margin: 6px 0 2px;
}
.auth-links-inline .muted { color: #7f8c8d; }
.auth-links-inline .sep { color: #bdc3c7; }
.auth-links-inline a { color: #3498db; text-decoration: none; }
.auth-links-inline a:hover { text-decoration: underline; }

/* Alerts */
.alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Date Selector */
.date-selector {
    background: white;
    padding: 0.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.date-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    position: relative;
}

.date-controls-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0 auto;
}

.date-controls .date-notice {
    color: #e67e22;
    font-size: 0.9rem;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    max-width: 50%;
}
.date-controls .date-notice:empty { display: none; }

.btn.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.date-selector h2 {
    text-align: center;
    color: #2c3e50;
}

.date-heading-row { position: relative; }
.date-heading-row h2 { margin: 0; }
.date-court { position: absolute; right: 0; top: 50%; transform: translateY(-50%); }
.date-court select { padding: 6px 10px; border-radius: 4px; border: 1px solid #ddd; }

/* Weather Info */
.weather-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.weather-content {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.weather-suggestion {
    margin-left: auto;
    background: #f39c12;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    margin-right:10px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.weather-main {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-right:30px;
}

.weather-icon {
    font-size: 3rem;
}

.weather-temp {
    font-size: 2.5rem;
    font-weight: bold;
}

.weather-details {
    display: flex;
    gap: 2rem;
}

.weather-detail {
    display: flex;
    flex-direction: column;
}

.weather-detail-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.weather-detail-value {
    font-size: 1.125rem;
    font-weight: 600;
}

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

/* Venues Grid */
.venues-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.venue-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-top: 4px solid transparent;
}

.venue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e0e0e0;
}

.venue-header h3 {
    color: #2c3e50;
    font-size: 1.25rem;
}

.venue-number {
    background-color: #3498db;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
}

/* Court type coloring */
.venue-card.type-pickleball { border-top-color: #2ecc71; }
.venue-card.type-basketball { border-top-color: #e67e22; }
.venue-card.type-badminton { border-top-color: #9b59b6; }
.venue-card.type-tennis { border-top-color: #27ae60; }
.venue-card.type-football { border-top-color: #16a085; }
.venue-card.type-table-tennis { border-top-color: #3498db; }
/* Ensure type color overrides the default blue */
.venue-card .venue-header .venue-number.type-pickleball { background-color: #2ecc71 !important; }
.venue-card .venue-header .venue-number.type-basketball { background-color: #e67e22 !important; }
.venue-card .venue-header .venue-number.type-badminton { background-color: #9b59b6 !important; }
.venue-card .venue-header .venue-number.type-tennis { background-color: #2980b9 !important; }
.venue-card .venue-header .venue-number.type-football { background-color: #16a085 !important; }
.venue-card .venue-header .venue-number.type-table-tennis { background-color: #3498db !important; }

.venue-info {
    margin-bottom: 1.5rem;
}

.venue-info p {
    margin-bottom: 0.5rem;
}

/* Time Slots */
.time-slots h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
}

.time-slot {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.75rem 0.5rem;
    text-align: center;
    transition: all 0.3s;
}

.time-slot.available {
    background-color: #d4edda;
    border-color: #28a745;
    cursor: pointer;
}

.time-slot.available:hover {
    background-color: #c3e6cb;
}

.time-slot.booked {
    background-color: #f8d7da;
    border-color: #dc3545;
}

.time-slot.closed {
    background-color: #ffe6cc;
    border-color: #e67e22;
}

.time-slot.past {
    background-color: #e9ecef;
    border-color: #ced4da;
    color: #6c757d;
}

.time-label {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.booking-status {
    font-size: 0.75rem;
    color: #6c757d;
}

.my-booking {
    color: #3498db;
    font-weight: 600;
}

/* Bookings Section */
.bookings-section {
    margin-bottom: 3rem;
}

.bookings-section h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
}

.bookings-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.booking-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.booking-card.past {
    opacity: 0.7;
}

.booking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e0e0e0;
}

.booking-header h3 {
    color: #2c3e50;
    font-size: 1.125rem;
}

.booking-details p {
    margin-bottom: 0.5rem;
}

.booking-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.badge-secondary {
    background-color: #e2e3e5;
    color: #383d41;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #000;
}

.modal-actions {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Responsive */
@media (max-width: 768px) {
    /* Allow header to show overflow menu */
    .main-header {
        overflow: visible !important;
    }
    
    /* Show hamburger menu button on mobile */
    .mobile-menu-toggle {
        display: flex !important;
    }
    
    /* Hide menu by default on mobile, show when active */
    .main-nav ul {
        position: absolute !important;
        top: calc(100% + 10px) !important;
        right: 20px !important;
        background: rgba(0, 0, 0, 0.95) !important;
        flex-direction: column !important;
        gap: 0 !important;
        width: auto !important;
        min-width: 200px !important;
        max-width: 300px !important;
        padding: 1rem 0 !important;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3) !important;
        border-radius: 8px !important;
        margin-top: 0 !important;
        display: none !important;
        z-index: 10000 !important;
        list-style: none !important;
    }
    
    .main-nav ul.active {
        display: flex !important;
    }
    
    .main-nav ul li {
        width: 100%;
        padding: 0.5rem 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .main-nav ul li:last-child {
        border-bottom: none;
    }
    
    .main-nav ul li a,
    .main-nav ul li button {
        width: 100%;
        text-align: left;
        padding: 0.5rem 0 0.5rem 1rem;
        display: block;
    }
    
    .user-menu {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .venues-grid,
    .bookings-list {
        grid-template-columns: 1fr;
    }
    
    .date-controls { 
        flex-direction: column; 
        gap: 8px;
    }
    .date-controls-inner {
        display: flex;
        gap: 8px;
        width: 100%;
    }
    .date-controls-inner button {
        flex: 1;
        min-width: 0;
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    .date-controls-inner input[type="date"] {
        flex: 1.5;
        min-width: 0;
        font-size: 0.875rem;
        padding: 0.5rem;
    }
    .date-controls .date-notice { 
        position: static; 
        transform: none;
        max-width: 100%;
        text-align: center;
        font-size: 0.8rem;
        margin-top: 4px;
    }
    
    .weather-info { padding: 0.75rem; }
    /* Keep a single row: left = icon+temp+desc, right = compact stats */
    .weather-content { flex-direction: row; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
    .weather-main { gap: 0.25rem; }
    .weather-icon { font-size: 2rem; }
    .weather-temp { font-size: 1.6rem; }
    .weather-details {
        display: grid;
        grid-template-columns: 1fr; /* stack compact items on the right */
        gap: 0.25rem 0.5rem;
    }
    .weather-detail-label { font-size: 0.75rem; }
    .weather-detail-value { font-size: 0.95rem; }
    .weather-suggestion {
        flex-basis: 100%;
        margin-left: 0;
        margin: 0 10px;
        align-self: stretch;
        padding: 0.35rem 0.75rem;
        font-size: 0.85rem;
        text-align: left;
    }

    .modal-content { width: 94%; margin: 10% auto; padding: 1.25rem; }
    .btn { padding: 0.6rem 1.1rem; }
    .date-heading-row { 
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    .date-heading-row h2 { 
        font-size: 1.1rem; 
        white-space: normal;
        word-wrap: break-word;
        line-height: 1.3;
    }
    .date-court { 
        position: static; 
        transform: none; 
        margin-top: 0;
        display: flex; 
        justify-content: flex-start;
        width: 100%;
    }
    .date-court select {
        width: 100%;
        max-width: 100%;
        font-size: 0.9rem;
    }
}

@media (max-width: 420px) {
    .weather-details { grid-template-columns: 1fr 1fr; }
    .weather-temp { font-size: 1.6rem; }
}

/* Booking Table Styles */
.booking-table-container {
    overflow-x: auto;
    margin: 20px 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.booking-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    table-layout: auto;
}

.booking-table thead {
    background-color: #2c3e50;
    color: white;
}

.booking-table th {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #ddd;
}

.booking-table th:first-child {
    text-align: left;
    padding-left: 12px;
    min-width: 120px;
    width: 120px;
    max-width: 120px;
    position: sticky;
    left: 0;
    background-color: #2c3e50;
    z-index: 10;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.booking-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.booking-table .time-cell {
    padding: 10px 12px;
    font-weight: 500;
    border: 1px solid #ddd;
    background-color: #f5f5f5;
    position: sticky;
    left: 0;
    z-index: 5;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
    min-width: 120px;
    width: 120px;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.booking-table tbody tr:nth-child(even) .time-cell {
    background-color: #f9f9f9;
}

.booking-table .booking-cell {
    padding: 12px 8px;
    text-align: center;
    border: 1px solid #ddd;
    vertical-align: middle;
    position: relative;
    min-width: 80px;
}

.booking-table .booking-cell.available {
    background-color: #d4edda;
    color: #155724;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.booking-table .booking-cell.available:hover {
    background-color: #c3e6cb;
}

.booking-table .booking-cell.booked {
    background-color: #f8d7da;
    color: #721c24;
}

.booking-table .booking-cell.closed {
    background-color: #d6d8db;
    color: #383d41;
}

.booking-table .booking-cell.past {
    background-color: #e9ecef;
    color: #6c757d;
}

.booking-table .available-mark {
    font-size: 1.2rem;
    font-weight: bold;
}

.booking-table .my-booking {
    color: #0056b3;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.booking-table .my-booking:hover {
    color: #004085;
}

.text-muted {
    color: #6c757d;
    font-size: 0.9em;
}

/* Responsive table */
@media (max-width: 768px) {
    .booking-table-container {
        margin: 10px -10px;
        border-radius: 0;
    }
    
    .booking-table th,
    .booking-table .booking-cell {
        padding: 8px 4px;
        font-size: 0.85rem;
    }
    
    .booking-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .booking-table {
        min-width: 100%;
    }
    
    .booking-table .time-cell {
        padding: 8px 6px;
        font-size: 0.8rem;
        min-width: 100px;
        width: 100px;
        max-width: 100px;
        background-color: #f5f5f5 !important;
        box-shadow: 2px 0 4px rgba(0,0,0,0.1);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .booking-table tbody tr:nth-child(even) .time-cell {
        background-color: #f9f9f9 !important;
    }
    
    .booking-table th:first-child {
        min-width: 100px;
        width: 100px;
        max-width: 100px;
        box-shadow: 2px 0 4px rgba(0,0,0,0.1);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .booking-table .booking-cell {
        min-width: 80px;
        white-space: nowrap;
    }
}

