/**
 * dashboard.css
 * 電腦端現代深色玻璃擬態儀表板樣式
 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-main: #0b0f19;
    --bg-surface: #111827;
    --card-bg: rgba(22, 30, 49, 0.7);
    --card-hover: rgba(30, 41, 67, 0.85);
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-indigo: #6366f1;
    --accent-green: #10b981;
    --accent-gold: #f59e0b;
    --accent-red: #ef4444;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(99, 102, 241, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(99, 102, 241, 0.08) 0%, transparent 40%);
}

/* 頂部導航列 */
.navbar {
    height: 72px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.brand-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(90deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-badge {
    font-size: 11px;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    padding: 2px 8px;
    border-radius: 9999px;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* 連線狀態標籤 */
.conn-status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(17, 24, 39, 0.8);
    border: 1px solid var(--border-glass);
    padding: 8px 16px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 500;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ef4444;
    box-shadow: 0 0 10px #ef4444;
}

.pulse-dot.connected {
    background-color: var(--accent-green);
    box-shadow: 0 0 12px var(--accent-green);
}

/* 按鈕風格 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
    color: #fff;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* 主容器 */
.main-content {
    flex: 1;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 32px 64px 32px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* 狀態看板 */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 18px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, border-color 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-hover);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: #fff;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* 發票瀑布流展示區 */
.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gallery-title {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.invoices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

/* 單張發票卡片 */
.invoice-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    animation: fadeInScale 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.invoice-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

@keyframes fadeInScale {
    0% { opacity: 0; transform: scale(0.92) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.card-preview-wrapper {
    position: relative;
    width: 100%;
    height: 280px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
}

.card-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    transition: transform 0.3s;
}

.invoice-card:hover .card-img {
    transform: scale(1.04);
}

.card-tag {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #38bdf8;
    border: 1px solid var(--border-glass);
}

.card-meta {
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(10, 15, 26, 0.4);
    border-top: 1px solid var(--border-glass);
}

.meta-time {
    font-size: 12px;
    color: var(--text-muted);
}

.card-actions {
    display: flex;
    gap: 8px;
}

.action-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 15px;
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.action-icon-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.action-icon-btn.delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

/* 空狀態提示 */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    background: var(--card-bg);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    text-align: center;
}

.empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.8;
}

.empty-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-desc {
    font-size: 14px;
    color: var(--text-muted);
    max-width: 420px;
    line-height: 1.6;
    margin-bottom: 24px;
}

/* 彈窗樣式 */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-window {
    background: #131b2e;
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    max-width: 440px;
    width: 100%;
    padding: 32px;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.open .modal-window {
    transform: scale(1);
}

.close-modal-btn {
    position: absolute;
    top: 18px;
    right: 18px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}

.qr-box {
    background: #fff;
    padding: 16px;
    border-radius: 16px;
    display: inline-block;
    margin: 20px 0 16px 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.qr-room-tag {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--accent-gold);
    margin-bottom: 8px;
}

/* 放大預覽彈窗 */
.preview-modal-window {
    max-width: 900px;
    width: 95vw;
    background: #0e1422;
    border-radius: 20px;
    overflow: hidden;
    padding: 0;
}

.preview-img-container {
    background: #000;
    height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.preview-large-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

/* Toast 提示 */
.toast-container {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast-msg {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: toastSlide 0.3s forwards;
}

@keyframes toastSlide {
    0% { transform: translateY(20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}
