/* ==========================================
   極光茶飲 - 智能點餐系統 專用樣式表
   設計風格：質感深色、玻璃擬態 (Glassmorphism)、微漸層、微交互
   ========================================== */

/* 1. 全域變數與重設 */
:root {
    --bg-gradient: linear-gradient(135deg, #090d16 0%, #11102b 50%, #20082b 100%);
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.07);
    --card-hover-bg: rgba(255, 255, 255, 0.07);
    --card-hover-border: rgba(255, 255, 255, 0.18);
    
    /* 質感色彩調色盤 */
    --primary: #8b5cf6;          /* 極光紫 */
    --primary-light: #a78bfa;
    --primary-gradient: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);
    
    --accent: #10b981;           /* 翡翠綠 */
    --accent-gradient: linear-gradient(135deg, #059669 0%, #10b981 100%);
    --accent-hover: #059669;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dark: #0f172a;
    
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', 'Noto Sans TC', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

/* 2. 應用程式外容器 */
.app-container {
    width: 100%;
    max-width: 1200px;
    background: rgba(9, 13, 22, 0.65);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--card-border);
    border-radius: 28px;
    padding: 30px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* 3. 頂部標題區 */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 20px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-emoji {
    font-size: 2.5rem;
    filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.5));
    animation: float 3s ease-in-out infinite;
}

.logo-text h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
}

.logo-text p {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 3px;
    font-weight: 600;
}

/* 連線狀態指示燈 */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    padding: 8px 16px;
    border-radius: 50px;
    border: 1px solid var(--card-border);
    font-size: 0.85rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #64748b;
}

.status-dot.connected {
    background-color: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

.status-dot.pulse {
    animation: pulse 1.5s infinite;
}

/* 4. 主要內容排版 */
.app-main {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 24px;
}

@media (max-width: 950px) {
    .app-main {
        grid-template-columns: 1fr;
    }
}

/* 5. 磨砂玻璃卡片 */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 22px;
    padding: 24px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

.glass-card.full-height {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 20px;
    border-left: 4px solid var(--primary);
    padding-left: 10px;
    color: var(--text-main);
}

/* 表單區塊分組與雙欄佈局 */
.form-group {
    margin-bottom: 20px;
}

.options-row {
    display: flex;
    gap: 16px;
}

.half-width {
    flex: 1;
}

@media (max-width: 500px) {
    .options-row {
        flex-direction: column;
        gap: 0;
    }
}

.group-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* 6. 茶飲選擇卡片格線 */
.tea-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

@media (max-width: 550px) {
    .tea-grid {
        grid-template-columns: 1fr;
    }
}

.tea-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    transition: var(--transition);
    color: var(--text-main);
    outline: none;
}

.tea-card:hover {
    background: var(--card-hover-bg);
    border-color: var(--card-hover-border);
    transform: translateY(-4px);
}

.tea-card.active {
    background: rgba(139, 92, 246, 0.12);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.25);
}

.tea-emoji {
    font-size: 2rem;
    margin-bottom: 2px;
}

.tea-name {
    font-size: 0.95rem;
    font-weight: 700;
}

.tea-price {
    font-size: 1rem;
    font-weight: 800;
    color: var(--primary-light);
}

.tea-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* 7. 規格按鈕格線 */
.option-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.option-grid.size-grid {
    grid-template-columns: repeat(2, 1fr);
}

.option-grid.addon-grid {
    grid-template-columns: repeat(3, 1fr);
}

.option-grid.compact {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 550px) {
    .option-grid.addon-grid {
        grid-template-columns: 1fr;
    }
}

.option-btn {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 11px 8px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    transition: var(--transition);
    text-align: center;
    outline: none;
}

.option-btn:hover {
    background: var(--card-hover-bg);
    border-color: var(--card-hover-border);
}

.option-btn.active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: var(--text-main);
    box-shadow: 0 4px 12px rgba(217, 70, 239, 0.25);
}

/* 8. 客人暱稱/備註輸入框 */
.name-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.name-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-light);
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.2);
}

.name-input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

/* 9. 數量與價格即時計算面板 */
.price-calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    padding: 16px 20px;
    border-radius: 16px;
    border: 1px solid var(--card-border);
    margin-top: 10px;
    gap: 16px;
}

.qty-section {
    display: flex;
    flex-direction: column;
}

.qty-section .group-label {
    margin-bottom: 6px;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition);
    outline: none;
}

.qty-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.35);
    transform: scale(1.05);
}

.qty-val {
    font-size: 1.15rem;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
}

.price-display-section {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.price-item {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.price-total {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
}

.highlight-price {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 10. 送出按鈕 */
.submit-btn {
    width: 100%;
    background: var(--accent-gradient);
    color: var(--text-main);
    border: none;
    padding: 16px;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
    margin-top: 10px;
    outline: none;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
    filter: brightness(1.1);
}

.submit-btn:active {
    transform: translateY(1px);
}

.arrow-icon {
    transition: var(--transition);
}

.submit-btn:hover .arrow-icon {
    transform: translateX(4px);
}

/* 11. 訂單看板 */
.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.board-header .section-title {
    margin-bottom: 0;
}

.badge {
    background: rgba(139, 92, 246, 0.16);
    border: 1px solid rgba(139, 92, 246, 0.35);
    color: var(--primary-light);
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
}

.order-list-container {
    flex: 1;
    overflow-y: auto;
    max-height: 520px;
    padding-right: 6px;
}

/* 自訂捲軸樣式 */
.order-list-container::-webkit-scrollbar {
    width: 6px;
}

.order-list-container::-webkit-scrollbar-track {
    background: transparent;
}

.order-list-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.order-list-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

.order-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 訂單卡片項目 */
.order-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.order-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
}

/* 已完成訂單的翡翠綠質感背景 */
.order-item.completed {
    background: rgba(16, 185, 129, 0.03);
    border-color: rgba(16, 185, 129, 0.15);
}

.order-item.completed:hover {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.25);
}

.order-item-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.order-item-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.order-item-name {
    font-size: 1.05rem;
    font-weight: 700;
}

.order-item-qty {
    font-size: 0.78rem;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--text-muted);
}

.order-item-specs {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.spec-tag {
    background: rgba(255, 255, 255, 0.03);
    padding: 2px 7px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.spec-tag.addons-tag {
    border-color: rgba(217, 70, 239, 0.2);
    color: #f472b6;
    background: rgba(217, 70, 239, 0.03);
}

.order-item-notes {
    font-size: 0.75rem;
    color: #fb923c;
    background: rgba(251, 146, 60, 0.05);
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid rgba(251, 146, 60, 0.15);
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 4px;
}

.order-item-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    margin-left: 12px;
}

.order-item-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.order-status-badge {
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 50px;
    font-weight: 600;
}

.order-status-badge.pending {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.order-status-badge.completed {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
}

/* 商家一鍵完成點單按鈕 */
.complete-order-btn {
    background: var(--accent-gradient);
    color: var(--text-main);
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.complete-order-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* 12. 讀取中與無資料狀態 */
.loading-state, .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
    gap: 12px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
    opacity: 0.6;
}

/* 13. 超美磨砂玻璃彈窗 (Modal) 樣式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 6, 10, 0.75);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* 模擬電子發票/收據的極致卡片 */
.receipt-card {
    background: rgba(20, 24, 38, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    width: 100%;
    max-width: 400px;
    padding: 28px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay:not(.hidden) .receipt-card {
    transform: scale(1);
}

/* 打勾打圈成功動畫 */
.success-icon-wrapper {
    position: relative;
    width: 56px;
    height: 56px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 16px;
}

.success-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid rgba(16, 185, 129, 0.2);
    border-radius: 50%;
}

.modal-overlay:not(.hidden) .success-ring {
    border-color: var(--accent);
    animation: pulseRing 1.2s infinite;
}

.checkmark {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--accent);
    transform: scale(0);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.2s;
}

.modal-overlay:not(.hidden) .checkmark {
    transform: scale(1);
}

.receipt-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 4px;
}

.receipt-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 18px;
}

.receipt-divider {
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 12px 0;
}

.receipt-divider.dotted {
    background: transparent;
    border-top: 1px dotted rgba(255, 255, 255, 0.2);
}

.receipt-body {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.85rem;
}

.receipt-label {
    color: var(--text-muted);
}

.receipt-value {
    color: var(--text-main);
    font-weight: 600;
    max-width: 65%;
    text-align: right;
    word-break: break-all;
}

.receipt-value.highlight {
    color: var(--primary-light);
}

.receipt-row.total {
    margin-top: 6px;
    font-size: 1rem;
    align-items: center;
}

.receipt-row.total .receipt-label {
    color: #ffffff;
    font-weight: 700;
}

.receipt-value.price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
}

/* 關閉收據按鈕 */
.close-receipt-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 24px;
    outline: none;
}

.close-receipt-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

/* 14. 動畫定義 */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.1); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes pulseRing {
    0% { transform: scale(0.95); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.5; }
    100% { transform: scale(0.95); opacity: 1; }
}

/* 15. 頁尾 */
.app-footer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--card-border);
    padding-top: 16px;
    margin-top: 8px;
}
