/**
 * TripXFun 旅遊團預訂系統 - 前端樣式
 */

/* ===== 全局樣式 ===== */
#tour-booking-calendar {
    max-width: 1200px;
    margin: 0 auto;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* ===== 英雄區塊 ===== */
.tour-hero {
    position: relative;
    height: 400px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 40px;
}

.tour-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.2) 100%);
}

.tour-hero-content {
    position: absolute;
    bottom: 40px;
    left: 40px;
    color: white;
    z-index: 2;
}

.tour-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.tour-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ===== 團期描述 ===== */
.tour-description {
    background: #f8f9fa;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 40px;
    border-left: 4px solid #3498db;
}

.tour-description p {
    margin: 0;
    font-size: 1.1rem;
    color: #555;
}

/* ===== 日曆容器 ===== */
.calendar-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 40px;
}

.calendar-header {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.calendar-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.month-navigation {
    display: flex;
    align-items: center;
    gap: 16px;
}

.month-nav-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.month-nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.current-month-display {
    font-size: 1.2rem;
    font-weight: 500;
    min-width: 120px;
    text-align: center;
}

/* ===== 日曆網格 ===== */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e9ecef;
}

.calendar-weekday {
    background: #f8f9fa;
    padding: 12px;
    text-align: center;
    font-weight: 600;
    color: #6c757d;
    font-size: 0.9rem;
}

.calendar-date {
    background: white;
    min-height: 120px;
    padding: 12px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.calendar-date:hover:not(.empty):not(.past):not(.full) {
    background: #f8f9fa;
    box-shadow: inset 0 0 0 2px #3498db;
}

.calendar-date.selected {
    background: #e3f2fd !important;
    box-shadow: inset 0 0 0 3px #2196f3;
}

.calendar-date.empty {
    background: #f8f9fa;
    cursor: default;
}

.calendar-date.past {
    background: #f5f5f5;
    color: #ccc;
    cursor: not-allowed;
}

.calendar-date.full {
    background: #ffebee;
    color: #d32f2f;
    cursor: not-allowed;
}

.calendar-date.no-tour {
    background: #fafafa;
    color: #bbb;
    cursor: not-allowed;
}

.calendar-date.clickable {
    position: relative;
}

.calendar-date.clickable::before {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #4caf50;
    border-radius: 50%;
}

.calendar-date.almost-full::before {
    background: #ff9800;
}

.calendar-date.special::before {
    background: #9c27b0;
}

/* ===== 日期元素 ===== */
.date-number {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    position: absolute;
    top: 8px;
    right: 8px;
}

.calendar-date.past .date-number {
    color: #ccc;
}

.date-price {
    margin-top: auto;
    font-size: 1.1rem;
    font-weight: 700;
    color: #3498db;
    text-align: center;
    margin-bottom: 4px;
}

.date-status {
    font-size: 0.75rem;
    text-align: center;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 500;
}

.status-icon {
    font-size: 0.8rem;
    margin-right: 2px;
}

/* ===== 狀態顏色 ===== */
.calendar-date.available .date-status {
    background: #e8f5e8;
    color: #2e7d32;
}

.calendar-date.almost-full .date-status {
    background: #fff3e0;
    color: #f57c00;
}

.calendar-date.full .date-status {
    background: #ffebee;
    color: #d32f2f;
}

.calendar-date.special .date-status {
    background: #f3e5f5;
    color: #7b1fa2;
}

/* ===== 預訂表單 ===== */
#booking-form-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 40px;
    display: none;
}

.booking-form {
    padding: 32px;
}

.booking-form-header {
    margin-bottom: 32px;
    text-align: center;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 24px;
}

.booking-form-header h3 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin: 0 0 8px 0;
}

.booking-form-header p {
    color: #6c757d;
    margin: 0;
    font-size: 1rem;
}

.form-group {
    margin-bottom: 24px;
}

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

.required {
    color: #e74c3c;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
    background: white;
}

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

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: #e74c3c;
}

.error-message {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 4px;
}

/* ===== 價格摘要 ===== */
.price-summary {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin: 24px 0;
}

.price-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.price-row.total {
    border-top: 2px solid #e9ecef;
    padding-top: 12px;
    margin-top: 12px;
    font-weight: 700;
    font-size: 1.3rem;
    color: #2c3e50;
}

.total-price {
    color: #e74c3c;
}

/* ===== 表單按鈕 ===== */
.form-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 32px;
}

.btn-submit,
.btn-cancel {
    padding: 14px 32px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 120px;
}

.btn-submit {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-cancel {
    background: #6c757d;
    color: white;
}

.btn-cancel:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* ===== 消息提示 ===== */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

.message-success {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
}

.message-error {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
}

.message-icon {
    font-size: 1.2rem;
}

.message-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== 響應式設計 ===== */
@media (max-width: 768px) {
    .tour-hero {
        height: 300px;
        margin-bottom: 24px;
    }
    
    .tour-hero-content {
        bottom: 24px;
        left: 24px;
    }
    
    .tour-title {
        font-size: 2rem;
    }
    
    .tour-subtitle {
        font-size: 1rem;
    }
    
    .calendar-header {
        padding: 16px;
        flex-direction: column;
        gap: 16px;
    }
    
    .calendar-date {
        min-height: 80px;
        padding: 8px;
    }
    
    .date-number {
        font-size: 0.8rem;
    }
    
    .date-price {
        font-size: 0.9rem;
    }
    
    .date-status {
        font-size: 0.7rem;
    }
    
    .booking-form {
        padding: 24px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn-submit,
    .btn-cancel {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .tour-hero-content {
        bottom: 16px;
        left: 16px;
        right: 16px;
    }
    
    .tour-title {
        font-size: 1.5rem;
    }
    
    .calendar-date {
        min-height: 60px;
    }
    
    .booking-form {
        padding: 16px;
    }
}

/* ===== 無障礙設計 ===== */
.calendar-date:focus {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

.btn-submit:focus,
.btn-cancel:focus {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
}

/* ===== 載入動畫 ===== */
.calendar-date.loading {
    position: relative;
}

.calendar-date.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}