/**
 * Hustavla.NO - CALENDAR STYLES (SHARED)
 * Single source of truth for booking calendar
 * Used by both admin and public views
 */

/* ===== CALENDAR NAVIGATION ===== */
.calendar-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}

.nav-btn {
    padding: 0.5rem 1rem;
    background: #4a5568;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: var(--font-weight-medium);
    transition: background 0.2s;
}

.nav-btn:hover {
    background: #2d3748;
}

.current-month {
    font-size: var(--font-size-h3);
    font-weight: var(--font-weight-bold);
    color: var(--color-neutral-dark);
    min-width: 180px;
    text-align: center;
}

/* ===== CALENDAR VIEW ===== */
.calendar-view {
    display: block;
}

.calendar-view.hidden {
    display: none;
}

/* Desktop: Constrain calendar width to match time slots view */
@media (min-width: 768px) {
    .calendar-view {
        max-width: 600px;
        margin: 0 auto;
    }
}

.calendar-loading,
.time-slot-loading {
    text-align: center;
    padding: var(--spacing-2xl);
    color: var(--color-neutral);
}

/* ===== FULL MONTH CALENDAR GRID ===== */
.calendar-month-grid {
    width: 100%;
    max-width: 100%;
}

.calendar-day-headers {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    margin-bottom: 4px;
}
.calendar-day-header {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #718096;
    padding: 0.4rem 0;
}

.calendar-day-header:nth-child(6),
.calendar-day-header:nth-child(7) {
    color: #e53e3e;
}

.calendar-week-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    margin-bottom: 3px;
}

.calendar-day {
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    background: white;
    min-height: 40px;
}

.calendar-day.weekend {
    color: #e53e3e;
}

.calendar-day.available {
    background: #f0fff4;
    border-color: #48bb78;
    cursor: pointer;
}

.calendar-day.available:hover {
    background: #c6f6d5;
}

.calendar-day.full {
    background: #fff5f5;
    color: var(--color-neutral);
    border-color: #e53e3e;
    cursor: pointer;
}

.calendar-day.full:hover {
    background: #ffcdd2;
}

.calendar-day.past-date {
    background: #f5f5f5;
    color: #bdbdbd;
    border-color: #e0e0e0;
    cursor: not-allowed;
}

.calendar-day.adjacent-month {
    color: #bdbdbd;
    opacity: 0.6;
}

.calendar-day.adjacent-month.past-date {
    background: #fafafa;
}

.calendar-day.disabled {
    background: #fafafa;
    color: #e0e0e0;
    border-color: #eeeeee;
    cursor: not-allowed;
}

.calendar-day.today {
    font-weight: 700;
    border: 2px solid #4a5568;
    background: #edf2f7;
}

.calendar-day.today.available {
    border-color: #48bb78;
    box-shadow: inset 0 0 0 2px #4a5568;
}

.day-number {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    line-height: 1;
}

.booking-count {
    font-size: 8px;
    color: var(--color-danger);
    font-weight: var(--font-weight-bold);
    line-height: 1;
    position: absolute;
    bottom: 2px;
    right: 2px;
}

/* ===== TIME SLOTS VIEW ===== */
.time-slots-view {
    display: none;
}

.time-slots-view.active {
    display: block;
}

.time-slots-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.time-slots-title {
    font-size: var(--font-size-h3);
    font-weight: var(--font-weight-bold);
    color: var(--color-neutral-dark);
}

.back-btn {
    padding: 0.4rem 0.75rem;
    background: #718096;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.back-btn:hover {
    background: #4a5568;
}

.timeslots-container {
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.time-slot-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin-bottom: var(--spacing-lg);
}

@media (min-width: 768px) {
    .time-slot-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.time-slot-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border: 2px solid #48bb78;
    border-radius: 4px;
    transition: all 0.2s;
    background: #f0fff4;
    gap: var(--spacing-8);
}

.time-slot-option.available {
    background: #f0fff4;
    border-color: #48bb78;
    cursor: pointer;
}

.time-slot-option.available:hover {
    background: #c6f6d5;
}

.time-slot-option.selected {
    background: #bbdefb;
    border: 3px solid var(--color-accent-primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.time-slot-option.booked {
    background: #fff5f5;
    border-color: #e53e3e;
    cursor: not-allowed;
}

.time-slot-option.admin-booked {
    cursor: default;
}

.time-slot-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-4);
    flex: 1;
}

.time-slot-label {
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-medium);
}

.time-slot-booked-by {
    font-size: var(--font-size-tiny);
    color: var(--color-neutral);
}

.time-slot-status {
    font-size: 0.875rem;
    color: #48bb78;
    font-weight: var(--font-weight-medium);
}

.time-slot-option.booked .time-slot-status {
    color: #e53e3e;
}

.cancel-btn {
    padding: var(--spacing-6) var(--spacing-12);
    background: var(--color-danger);
    color: white;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-small);
    transition: background 0.2s;
    white-space: nowrap;
}

.cancel-btn:hover {
    background: var(--color-danger-dark);
}

.close-calendar-btn {
    padding: var(--spacing-8) var(--spacing-lg);
    background: var(--color-neutral-lighter);
    color: white;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-weight: var(--font-weight-medium);
    margin-top: var(--spacing-lg);
    width: 100%;
    transition: background 0.2s;
}

.close-calendar-btn:hover {
    background: var(--color-neutral-lightest);
}

/* ===== CALENDAR CONTAINER STYLES ===== */
.booking-calendar-inline {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: var(--border-width-thin) solid var(--color-border);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.booking-resource-link {
    display: inline-block;
    margin-top: var(--spacing-md);
    color: var(--color-accent-primary);
    font-size: var(--font-size-small);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
}

.booking-resource-link:hover {
    text-decoration: underline;
}

/* ===== BOOKING MODAL ===== */
.booking-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
}

.booking-modal.active {
    display: flex;
}

.booking-modal-content {
    background: var(--color-bg-white);
    border-radius: var(--radius-md);
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.booking-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: var(--border-width-thin) solid var(--color-border);
}

.booking-modal-header h2 {
    margin: 0;
    font-size: var(--font-size-h3);
    color: var(--color-neutral-dark);
}

.booking-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--color-neutral);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
    transition: background 0.2s;
}

.booking-modal-close:hover {
    background: var(--color-neutral-lightest);
}

.booking-modal-body {
    padding: var(--spacing-lg);
}

.booking-details {
    background: var(--color-bg-light);
    padding: var(--spacing-md);
    border-radius: var(--radius-xs);
    margin-bottom: var(--spacing-lg);
}

.booking-details p {
    margin: var(--spacing-4) 0;
    font-size: var(--font-size-base);
    color: var(--color-neutral-dark);
}

.booking-details strong {
    color: var(--color-neutral-darker);
}

.booking-form-group {
    margin-bottom: var(--spacing-lg);
}

.booking-form-group label {
    display: block;
    margin-bottom: var(--spacing-6);
    font-weight: var(--font-weight-medium);
    color: var(--color-neutral-dark);
    font-size: var(--font-size-base);
}

.booking-form-group input[type="email"],
.booking-form-group input[type="text"],
.booking-form-group textarea {
    width: 100%;
    padding: var(--spacing-10);
    border: var(--border-width-thin) solid var(--color-border);
    border-radius: var(--radius-xs);
    font-size: var(--font-size-base);
    transition: border-color 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.booking-form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.booking-form-group input[type="email"]:focus,
.booking-form-group input[type="text"]:focus,
.booking-form-group textarea:focus {
    outline: none;
    border-color: var(--color-accent-primary);
}

.booking-error-message {
    background: #ffebee;
    color: var(--color-danger);
    padding: var(--spacing-10);
    border-radius: var(--radius-xs);
    margin-bottom: var(--spacing-md);
    font-size: var(--font-size-small);
    border-left: 4px solid var(--color-danger);
}

.booking-success-message {
    background: #e8f5e9;
    color: var(--color-success);
    padding: var(--spacing-10);
    border-radius: var(--radius-xs);
    font-size: var(--font-size-base);
    border-left: 4px solid var(--color-success);
    text-align: center;
}

.booking-submit-btn {
    width: 100%;
    padding: var(--spacing-12);
    background: var(--color-accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-xs);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: background 0.2s;
}

.booking-submit-btn:hover:not(:disabled) {
    background: var(--color-accent-primary-dark);
}

.booking-submit-btn:disabled {
    background: var(--color-neutral-lighter);
    cursor: not-allowed;
}

/* ===== BOOKING FORM STYLES ===== */
.booking-form {
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--color-bg-light);
    border-radius: var(--radius-xs);
    border: 2px solid var(--color-accent-primary);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.booking-email-input {
    width: 100%;
    padding: var(--spacing-10);
    border: var(--border-width-thin) solid var(--color-border);
    border-radius: var(--radius-xs);
    font-size: var(--font-size-base);
    margin-bottom: var(--spacing-md);
    box-sizing: border-box;
}

.booking-email-input:focus {
    outline: none;
    border-color: var(--color-accent-primary);
}

.booking-message {
    margin-top: var(--spacing-md);
    padding: var(--spacing-8);
    border-radius: var(--radius-xs);
    font-size: var(--font-size-small);
    display: none;
}

.booking-message.success {
    background: #e8f5e9;
    color: var(--color-success);
    border-left: 4px solid var(--color-success);
    display: block;
}

.booking-message.error {
    background: #ffebee;
    color: var(--color-danger);
    border-left: 4px solid var(--color-danger);
    display: block;
}

.registration-redirect-btn {
    margin-top: var(--spacing-8);
    padding: var(--spacing-8) var(--spacing-12);
    background: var(--color-accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-medium);
    width: 100%;
}

.registration-redirect-btn:hover {
    background: var(--color-accent-primary-dark);
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 767px) {
    .calendar-navigation {
        gap: var(--spacing-8);
    }
    
    .current-month {
        font-size: var(--font-size-base);
        min-width: 140px;
    }
    
    .nav-btn,
    .today-btn {
        padding: var(--spacing-4) var(--spacing-8);
        font-size: var(--font-size-tiny);
    }
    
    .calendar-day-headers {
        gap: var(--spacing-2);
    }
    
    .calendar-week-row {
        gap: var(--spacing-2);
    }
    
    .calendar-day {
        padding: var(--spacing-2);
    }
    
    .day-number {
        font-size: var(--font-size-small);
    }
    
    .booking-count {
        font-size: 7px;
    }
    
    .calendar-day-header {
        font-size: var(--font-size-tiny);
        padding: var(--spacing-2);
    }
    
    .booking-modal {
        padding: var(--spacing-md);
    }
    
    .booking-modal-content {
        max-width: 100%;
    }
}
