/* 桌球室預訂系統 - 前端樣式 */

/* 基礎變數 */
:root {
    --bb-primary: #0073aa;
    --bb-primary-hover: #005a87;
    --bb-success: #28a745;
    --bb-danger: #dc3545;
    --bb-warning: #ffc107;
    --bb-info: #17a2b8;
    --bb-light: #f8f9fa;
    --bb-dark: #343a40;
    --bb-border: #ddd;
    --bb-radius: 6px;
    --bb-shadow: 0 2px 4px rgba(0,0,0,0.1);
    --bb-shadow-hover: 0 4px 8px rgba(0,0,0,0.15);
}

/* 重置和基礎樣式 */
.bb-booking-container * {
    box-sizing: border-box;
}

.bb-booking-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* 表單元素 */
.bb-form-group {
    margin-bottom: 1.5rem;
}

.bb-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.bb-form-control {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid var(--bb-border);
    border-radius: var(--bb-radius);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.bb-form-control:focus {
    outline: none;
    border-color: var(--bb-primary);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.bb-form-control::placeholder {
    color: #6c757d;
    opacity: 1;
}

/* 按鈕 */
.bb-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--bb-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1.5;
    min-width: 120px;
    user-select: none;
}

.bb-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.25);
}

.bb-btn-primary {
    background-color: var(--bb-primary);
    color: white;
}

.bb-btn-primary:hover:not(:disabled) {
    background-color: var(--bb-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--bb-shadow-hover);
}

.bb-btn-success {
    background-color: var(--bb-success);
    color: white;
}

.bb-btn-success:hover:not(:disabled) {
    background-color: #218838;
    transform: translateY(-1px);
}

.bb-btn-danger {
    background-color: var(--bb-danger);
    color: white;
}

.bb-btn-danger:hover:not(:disabled) {
    background-color: #c82333;
    transform: translateY(-1px);
}

.bb-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.bb-btn-block {
    width: 100%;
    display: block;
}

/* 卡片 */
.bb-card {
    background: white;
    border-radius: var(--bb-radius);
    box-shadow: var(--bb-shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
    transition: box-shadow 0.3s ease;
}

.bb-card:hover {
    box-shadow: var(--bb-shadow-hover);
}

.bb-card-header {
    padding: 1rem 1.25rem;
    background-color: var(--bb-light);
    border-bottom: 1px solid var(--bb-border);
    font-weight: 600;
}

.bb-card-body {
    padding: 1.25rem;
}

.bb-card-footer {
    padding: 1rem 1.25rem;
    background-color: var(--bb-light);
    border-top: 1px solid var(--bb-border);
}

/* 時間段選擇器 */
.bb-time-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.bb-time-slot {
    padding: 1rem;
    border: 2px solid var(--bb-border);
    border-radius: var(--bb-radius);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    position: relative;
}

.bb-time-slot:hover:not(.unavailable) {
    border-color: var(--bb-primary);
    transform: translateY(-2px);
    box-shadow: var(--bb-shadow);
}

.bb-time-slot.selected {
    background: var(--bb-primary);
    color: white;
    border-color: var(--bb-primary);
}

.bb-time-slot.unavailable {
    background: #f5f5f5;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.bb-time-slot-time {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.bb-time-slot-price {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* 房間卡片 */
.bb-room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.bb-room-card {
    background: white;
    border-radius: var(--bb-radius);
    box-shadow: var(--bb-shadow);
    overflow: hidden;
    transition: all 0.3s ease;
}

.bb-room-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.bb-room-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    position: relative;
}

.bb-room-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.bb-room-card:hover .bb-room-image img {
    transform: scale(1.05);
}

.bb-room-content {
    padding: 1.25rem;
}

.bb-room-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: #333;
}

.bb-room-description {
    color: #666;
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.bb-room-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.bb-room-capacity {
    color: #666;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.bb-room-price {
    color: var(--bb-primary);
    font-weight: 600;
    font-size: 1rem;
}

/* 購物車 */
.bb-cart-container {
    background: white;
    border-radius: var(--bb-radius);
    box-shadow: var(--bb-shadow);
    padding: 1.5rem;
    margin: 1rem 0;
}

.bb-cart-item {
    border: 1px solid var(--bb-border);
    border-radius: var(--bb-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.bb-cart-item:hover {
    box-shadow: var(--bb-shadow);
}

.bb-cart-item-details {
    flex: 1;
}

.bb-cart-item-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.bb-cart-item-info {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.bb-cart-item-price {
    font-weight: 600;
    color: var(--bb-primary);
}

.bb-cart-item-remove {
    background: var(--bb-danger);
    color: white;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: var(--bb-radius);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.bb-cart-item-remove:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.bb-cart-total {
    text-align: right;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--bb-primary);
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--bb-light);
    border-radius: var(--bb-radius);
}

.bb-cart-empty {
    text-align: center;
    padding: 2rem;
    color: #666;
}

/* 浮動購物車按鈕 */
.bb-cart-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bb-primary);
    color: white;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 1.5rem;
}

.bb-cart-float:hover {
    background: var(--bb-primary-hover);
    transform: scale(1.1);
    color: white;
}

.bb-cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--bb-danger);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    border: 2px solid white;
}

/* 模態框 */
.bb-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: bb-fade-in 0.3s ease;
}

.bb-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.bb-modal-content {
    background-color: white;
    border-radius: var(--bb-radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: bb-slide-in 0.3s ease;
}

.bb-modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--bb-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bb-modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.bb-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.bb-modal-close:hover {
    background: var(--bb-light);
    color: #333;
}

.bb-modal-body {
    padding: 1.5rem;
}

.bb-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--bb-border);
    text-align: right;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* 動畫 */
@keyframes bb-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes bb-slide-in {
    from { 
        opacity: 0; 
        transform: translateY(-50px) scale(0.9); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

.bb-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--bb-primary);
    border-radius: 50%;
    animation: bb-spin 1s linear infinite;
}

@keyframes bb-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 通知 */
.bb-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: var(--bb-radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 1rem 1.5rem;
    z-index: 10001;
    min-width: 300px;
    animation: bb-slide-in-right 0.3s ease;
}

.bb-notification.success {
    border-left: 4px solid var(--bb-success);
}

.bb-notification.error {
    border-left: 4px solid var(--bb-danger);
}

.bb-notification.warning {
    border-left: 4px solid var(--bb-warning);
}

.bb-notification.info {
    border-left: 4px solid var(--bb-info);
}

@keyframes bb-slide-in-right {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 響應式設計 */
@media (max-width: 768px) {
    .bb-room-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .bb-time-slots {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.5rem;
    }
    
    .bb-time-slot {
        padding: 0.75rem 0.5rem;
    }
    
    .bb-cart-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .bb-cart-item-remove {
        align-self: flex-end;
    }
    
    .bb-modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .bb-modal-footer {
        flex-direction: column;
    }
    
    .bb-modal-footer .bb-btn {
        width: 100%;
    }
    
    .bb-cart-float {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .bb-cart-count {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .bb-room-content {
        padding: 1rem;
    }
    
    .bb-room-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .bb-cart-container {
        padding: 1rem;
        margin: 0.5rem 0;
    }
    
    .bb-notification {
        left: 10px;
        right: 10px;
        min-width: auto;
    }
}
