/* ===== GLOBAL STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Trebuchet MS, sans-serif;
    background: #f8f9f7;
    min-height: 100vh;
    padding: 20px;
}

/* ===== LOGIN PAGE ===== */
.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f8f9f7 0%, #e8ebe5 100%);
    z-index: 2000;
}

.login-screen.hidden {
    display: none;
}

.login-box {
    background: white;
    padding: 50px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(34, 97, 46, 0.12);
    max-width: 400px;
    width: 90%;
    border-top: 4px solid #226156;
}

.login-box h1 {
    color: #226156;
    text-align: center;
    margin-bottom: 10px;
    font-size: 28px;
    font-weight: 600;
}

.login-box p {
    color: #666;
    text-align: center;
    margin-bottom: 30px;
    font-size: 14px;
}

/* ===== FORM ELEMENTS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    background: #fafafa;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #226156;
    background: white;
    box-shadow: 0 0 0 3px rgba(34, 97, 86, 0.1);
}

.form-group small {
    display: block;
    color: #888;
    margin-top: 5px;
    font-size: 12px;
}

/* ===== BUTTONS ===== */
.btn {
    background: #226156;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn:hover {
    background: #1a4a42;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 97, 86, 0.2);
}

.btn-secondary {
    background: #226156;
}

.btn-secondary:hover {
    background: #1a4a42;
}

.btn-logout {
    background: #b8404a;
    padding: 8px 16px;
    font-size: 14px;
}

.btn-logout:hover {
    background: #993639;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    margin-right: 5px;
}

.btn-confirm {
    background: #226156;
}

.btn-confirm:hover {
    background: #1a4a42;
}

.btn-cancel {
    background: #b8404a;
}

.btn-cancel:hover {
    background: #993639;
}

/* ===== MAIN APP CONTAINER ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
}

.container.hidden {
    display: none;
}

/* ===== HEADER ===== */
.header {
    background: white;
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(34, 97, 86, 0.08);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    border-top: 3px solid #226156;
}

.header h1 {
    color: #226156;
    font-size: 24px;
    margin: 0;
    font-weight: 600;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.user-info {
    color: #888;
    font-size: 14px;
}

.nav-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.sync-status {
    color: #888;
    font-size: 12px;
    padding: 5px 10px;
    background: #f5f5f5;
    border-radius: 4px;
    font-weight: 500;
}

.sync-status.syncing {
    color: #b8860b;
    animation: pulse 1s infinite;
}

.sync-status.error {
    color: #b8404a;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ===== CALENDAR GRID ===== */
.calendar-grid {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(34, 97, 86, 0.08);
    margin-bottom: 20px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
}

.month-year {
    font-size: 20px;
    font-weight: 600;
    color: #226156;
    flex: 1;
    text-align: center;
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.weekday {
    text-align: center;
    font-weight: 600;
    color: #226156;
    padding: 10px;
    font-size: 12px;
}

.days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    min-height: 320px;
}

.day {
    aspect-ratio: 1;
    border: 1px solid #ddd;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    padding: 8px;
    text-align: center;
    min-height: 40px;
}

.day:hover {
    border-color: #226156;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 97, 86, 0.15);
}

.day.other-month {
    color: #ccc;
    background: #f9f9f9;
    cursor: default;
}

.day.other-month:hover {
    transform: none;
    box-shadow: none;
    border-color: #ddd;
}

.day.today {
    border-color: #226156;
    background: #e8f1ef;
    font-weight: 600;
    color: #226156;
}

.day.booked {
    background: #d4e8e5;
    border-color: #226156;
}

.day.confirmed {
    background: #d4e8e5;
    border-color: #226156;
}

.day.pending {
    background: #fef3c7;
    border-color: #b8860b;
}

.day.cancelled {
    background: #fee2e2;
    border-color: #b8404a;
    opacity: 0.7;
}

.day-number {
    font-size: 16px;
    font-weight: 600;
    color: #226156;
}

.day-info {
    font-size: 10px;
    margin-top: 3px;
    color: #666;
    line-height: 1.2;
    word-break: break-word;
}

/* Highlight bookings owned by current user */
.day.mine {
    box-shadow: 0 6px 18px rgba(34,97,86,0.12);
    border-width: 2px;
}

.booking-item.mine {
    border-left-color: #154d44;
    box-shadow: 0 6px 18px rgba(34,97,86,0.06);
}

/* ===== BOOKINGS LIST ===== */
.bookings-list {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(34, 97, 86, 0.08);
}

.bookings-list h2 {
    color: #226156;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
}

.booking-item {
    background: #f8f9f7;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    border-left: 4px solid #226156;
}

.booking-item.confirmed {
    border-left-color: #226156;
    background: #e8f1ef;
}

.booking-item.cancelled {
    border-left-color: #b8404a;
    background: #fef2f2;
    opacity: 0.8;
}

.booking-item.pending {
    border-left-color: #b8860b;
    background: #fffbeb;
}

.booking-info {
    flex: 1;
}

.booking-date {
    font-weight: 600;
    color: #226156;
    margin-bottom: 5px;
    font-size: 14px;
}

.booking-name {
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.booking-user {
    color: #888;
    font-size: 12px;
    margin-top: 3px;
}

.booking-status {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    margin-top: 5px;
    background: #e8e8e8;
    color: #555;
}

.booking-status.confirmed {
    background: #d4e8e5;
    color: #1a4a42;
}

.booking-status.cancelled {
    background: #fee2e2;
    color: #8b2e2f;
}

.booking-status.pending {
    background: #fef3c7;
    color: #92400e;
}

.booking-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(34, 97, 86, 0.15);
    max-height: 90vh;
    overflow-y: auto;
    border-top: 4px solid #226156;
}

.modal h2 {
    color: #226156;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 600;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-modal-cancel {
    background: #999;
}

.btn-modal-cancel:hover {
    background: #777;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-buttons {
        width: 100%;
        justify-content: space-between;
    }

    .calendar-grid {
        padding: 15px;
    }

    .weekdays {
        gap: 5px;
        margin-bottom: 10px;
    }

    .weekday {
        font-size: 10px;
        padding: 5px 2px;
    }

    .days {
        grid-template-columns: repeat(7, 1fr);
        gap: 5px;
        min-height: auto;
        grid-auto-rows: 60px; /* fixed shorter rows to fit better */
    }

    .day {
        min-height: 60px;
        aspect-ratio: auto;
        padding: 6px;
        touch-action: manipulation;
    }

    .day-number {
        font-size: 12px;
        font-weight: 600;
    }

    .day-info {
        font-size: 9px;
        margin-top: 2px;
    }

    .booking-item {
        flex-direction: column;
        padding: 12px;
    }

    .booking-actions {
        justify-content: flex-start;
        width: 100%;
        gap: 4px;
    }

    .btn-small {
        padding: 5px 10px;
        font-size: 12px;
        margin-right: 0;
    }

    .modal-content {
        padding: 20px;
    }

    .month-year {
        font-size: 18px;
    }

    .calendar-header {
        gap: 5px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .header {
        padding: 15px 10px;
    }

    .calendar-grid {
        padding: 10px;
        margin-bottom: 15px;
    }

    .weekdays {
        gap: 3px;
        margin-bottom: 8px;
    }

    .weekday {
        font-size: 9px;
        padding: 3px;
    }

    .days {
        gap: 3px;
        grid-auto-rows: 52px; /* compact rows on narrow phones */
    }

    .day {
        min-height: 52px;
        padding: 4px;
    }

    .day-number {
        font-size: 11px;
    }

    /* Hide extra day info on very small screens to reduce wrapping */
    .day-info {
        display: none;
    }

    .bookings-list {
        padding: 15px 10px;
    }

    .booking-item {
        padding: 10px;
        margin-bottom: 8px;
    }

    .booking-date {
        font-size: 12px;
    }

    .booking-name {
        font-size: 13px;
    }

    .btn-small {
        padding: 4px 8px;
        font-size: 11px;
    }

    .login-box {
        padding: 30px 20px;
    }

    .login-box h1 {
        font-size: 24px;
    }

    .modal-content {
        padding: 15px;
    }
}
