:root {
    --bg-dark: #09070f;
    --bg-card: rgba(17, 12, 28, 0.65);
    --bg-secondary: rgba(30, 20, 50, 0.4);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(56, 189, 248, 0.4);
    --text-primary: #f3f4f6;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --text-hint: #6b7280;
    --color-accent: #0ea5e9;
    --color-accent-light: #38bdf8;
    --color-green: #10b981;
    --color-red: #ef4444;
    --radius-md: 8px;
    --radius-sm: 4px;
    --shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-neon: 0 0 12px rgba(56, 189, 248, 0.3);
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', 'Noto Sans TC', -apple-system, sans-serif;
    line-height: 1.4;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 12px;
}

/* 頁首 Header */
.app-header {
    position: relative;
    padding: 10px 0 6px;
    background: radial-gradient(circle at 50% 0%, rgba(14, 165, 233, 0.15) 0%, transparent 60%);
    border-bottom: 1px solid var(--border-color);
}

.header-bg-gradient {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-accent), var(--color-green));
}

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(14, 165, 233, 0.05);
    padding: 2px 8px;
    border-radius: 50px;
    border: 1px solid var(--border-color);
}

.logo-icon {
    font-size: 0.95rem;
    color: var(--color-accent);
    text-shadow: 0 0 8px rgba(14, 165, 233, 0.5);
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.5px;
}

#app-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

/* 語言選擇器 */
.lang-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 3px 8px;
    transition: var(--transition-fast);
}

.lang-selector-wrapper:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.lang-icon {
    font-size: 11px;
    color: var(--text-secondary);
}

.lang-select-dropdown {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    font-family: inherit;
}

.lang-select-dropdown option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

/* 主版面佈局 */
.main-content {
    flex: 1;
    padding: 8px 0 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 狀態工具列 */
.status-download-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-sm);
}

.status-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pulse-indicator {
    width: 6px;
    height: 6px;
    background-color: var(--color-green);
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 6px var(--color-green);
}

.pulse-indicator::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: inherit;
    border-radius: 50%;
    animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2.5); opacity: 0; }
}

.status-text {
    font-size: 10px;
    color: var(--text-secondary);
}

.update-time-box {
    font-size: 10px;
    color: var(--text-hint);
}

/* 卡片樣式 */
.card {
    background-color: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}

.card-title {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
}

/* 篩選與搜尋 */
.filter-card {
    padding: 6px 10px;
}

.filter-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.search-box-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-icon {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 11px;
}

.search-box-wrapper input {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px 8px 4px 26px;
    color: var(--text-primary);
    font-size: 11px;
    outline: none;
    transition: var(--transition-fast);
}

.search-box-wrapper input:focus {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-neon);
}

.category-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.tab-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.tab-btn.active {
    background: var(--color-accent);
    color: #09070f;
    border-color: var(--color-accent);
    font-weight: 600;
}

/* 表格樣式 */
.table-card {
    padding: 0;
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
}

.quota-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    text-align: left;
}

.quota-table th,
.quota-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-color);
}

.quota-table th {
    background: rgba(0, 0, 0, 0.3);
    color: var(--color-accent-light);
    font-weight: 600;
}

.quota-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.quota-table tr:last-child td {
    border-bottom: none;
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.model-api-name {
    font-family: 'Outfit', 'Consolas', monospace;
    color: var(--text-muted);
    font-size: 10px;
}

.badge {
    display: inline-block;
    padding: 1px 6px;
    font-size: 9px;
    font-weight: 500;
    border-radius: var(--radius-sm);
}

.badge-text {
    background: rgba(56, 189, 248, 0.1);
    color: var(--color-accent-light);
}

.badge-video {
    background: rgba(168, 85, 247, 0.1);
    color: #c084fc;
}

.badge-live {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
}

.badge-other {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
}

.badge-speech {
    background: rgba(236, 72, 153, 0.1);
    color: #f472b6;
}

.badge-grounding {
    background: rgba(20, 184, 166, 0.1);
    color: #2dd4bf;
}

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

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

.limit-val {
    font-family: 'Outfit', monospace;
    font-weight: 600;
}

.limit-val.high {
    color: var(--color-green);
}

.limit-val.low {
    color: var(--color-accent-light);
}

.limit-val.na {
    color: var(--text-hint);
    font-weight: 400;
}

/* 說明區塊 */
.help-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.help-box {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.help-label {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 600;
}

.help-value {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-accent-light);
}

.help-desc {
    font-size: 9px;
    color: var(--text-hint);
    line-height: 1.3;
}

/* 頁尾 */
.app-footer {
    padding: 12px 0;
    text-align: center;
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid var(--border-color);
    font-size: 10px;
    color: var(--text-muted);
}

.github-badge {
    color: var(--text-hint);
    font-size: 9px;
    margin-top: 2px;
}

/* RWD 微調 */
@media (max-width: 768px) {
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .category-tabs {
        justify-content: flex-start;
    }
    
    .help-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Amazon Affiliate Cards */
.amazon-affiliate-card {
    margin-top: 25px;
    margin-bottom: 25px;
}
.amz-item-card {
    transition: var(--transition-smooth);
}
.amz-item-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 153, 0, 0.05) !important;
    border-color: rgba(255, 153, 0, 0.3) !important;
    box-shadow: 0 8px 30px rgba(255, 153, 0, 0.08);
}
