/**
 * 基礎樣式 - Base Styles
 * 全域重設、CSS 變數、基礎排版
 */

/* CSS 變數定義 */
:root {
    /* 顏色 - 黑金主題 (Black & Gold Luxury) */
    --color-primary: #d4a520;
    --color-primary-hover: #f5c542;
    --color-primary-dark: #b8860b;
    --color-gold: #ffd700;
    --color-gold-light: #ffe066;
    --color-gold-dark: #c9a227;
    --color-success: #4caf50;
    --color-error: #ff6b6b;
    --color-warning: #ff9800;

    /* 深色主題顏色 */
    --bg-dark: #0a0a0a;
    --bg-dark-secondary: #111111;
    --bg-dark-card: #151515;
    --bg-dark-elevated: #1a1a1a;
    --text-dark: #fff;
    --text-dark-secondary: #888;
    --border-dark: #2a2a2a;

    /* 淺色主題顏色 - 白金 (White & Gold) */
    --bg-light: #fffdf8;
    --bg-light-secondary: #fff;
    --bg-light-card: #fff;
    --bg-light-elevated: #faf8f2;
    --text-light: #1a1a1a;
    --text-light-secondary: #8b6914;
    --border-light: rgba(184, 134, 11, 0.15);

    /* 間距 */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* 圓角 */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.625rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

    /* 陰影 */
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.2);
    --shadow-md: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.4);
    --shadow-primary: 0 0.5rem 1rem rgba(212, 165, 32, 0.4);
    
    /* 過渡動畫 */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* 字型 */
    --font-family: 'Roboto', sans-serif;
    --font-size-xs: 0.625rem;
    --font-size-sm: 0.75rem;
    --font-size-md: 0.875rem;
    --font-size-lg: 1rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    
    /* Z-index 層級 */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal: 1000;
    --z-toast: 9999;

    /* 側邊欄尺寸 */
    --sidebar-width-expanded: 240px;
    --sidebar-width-collapsed: 64px;
}

/* 全域重設樣式 */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow-x: hidden;
    scrollbar-gutter: stable; /* 預留捲軸空間，防止版面跳動 */
    scrollbar-width: none; /* Firefox 隱藏捲軸 */
    -ms-overflow-style: none; /* IE/Edge 隱藏捲軸 */
}

body {
    height: 100%;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    font-family: var(--font-family);
    background:
        radial-gradient(ellipse at 0% 0%, rgba(212, 165, 32, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 100% 100%, rgba(255, 215, 0, 0.02) 0%, transparent 50%),
        linear-gradient(180deg, #0a0a0a 0%, #0d0d0d 50%, #080808 100%);
    background-attachment: fixed;
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    min-height: 100%;
    line-height: 1.6;
}

/* 焦點樣式 */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* 滾動條樣式 (Webkit) - 隱藏主頁面捲軸 */
html::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

/* 其他元素的滾動條樣式 (如 sidebar、modal 等) */
*:not(html)::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*:not(html)::-webkit-scrollbar-track {
    background: var(--bg-dark-secondary);
}

*:not(html)::-webkit-scrollbar-thumb {
    background: var(--border-dark);
    border-radius: var(--radius-sm);
}

*:not(html)::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* 選取文字樣式 */
::selection {
    background-color: var(--color-primary);
    color: var(--text-dark);
}

/* 連結基礎樣式 */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-normal);
}

a:hover {
    color: var(--color-primary-hover);
}

/* 圖片基礎樣式 */
img {
    max-width: 100%;
    height: auto;
}

/* 按鈕重設 */
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* 輸入框重設 */
input,
textarea,
select {
    font-family: inherit;
}

/* ========== 全域動畫 ========== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* 頁面載入動畫 */
main {
    animation: fadeIn 0.4s ease-out;
}

/* 平滑滾動 */
html {
    scroll-behavior: smooth;
}
