/* ===== 基本樣式重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
    background: #f8fafb;
    overflow-x: hidden;
}

/* ===== 響應式變數 ===== */
:root {
    --sidebar-width-desktop: 280px;
    --header-height-desktop: 88px;
    --header-height-mobile: 70px;
    --padding-desktop: 32px;
    --padding-tablet: 24px;
    --padding-mobile: 16px;
    --card-gap-desktop: 24px;
    --card-gap-mobile: 16px;
}

/* ===== 頂部導航 - 響應式 ===== */
.header {
    background: linear-gradient(135deg, #2d5a4a 0%, #1e3a33 100%);
    color: white;
    padding: 20px var(--padding-desktop);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 20px rgba(0,0,0,0.12);
    height: var(--header-height-desktop);
    position: relative;
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 24px;
    font-weight: 600;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(74, 222, 128, 0.3);
}

.header-center {
    display: flex;
    align-items: center;
    gap: 32px;
}

.quick-actions {
    display: flex;
    gap: 16px;
}

.quick-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}

.quick-btn:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-1px);
}

.quick-btn.add-shelf {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: #10b981;
}

.quick-btn.add-shelf:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.datetime {
    font-size: 16px;
    opacity: 0.9;
    font-weight: 500;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255,255,255,0.1);
    padding: 12px 16px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: white;
}

/* 手機選單按鈕 */
.mobile-menu-btn {
    display: none;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
}

/* ===== 主要佈局 - 響應式 ===== */
.main-container {
    display: flex;
    min-height: calc(100vh - var(--header-height-desktop));
    position: relative;
}

/* ===== 側邊欄 - 響應式 ===== */
.sidebar {
    width: var(--sidebar-width-desktop);
    background: #1e3a33;
    color: white;
    padding: 32px 0;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 100;
}

.sidebar.mobile-hidden {
    transform: translateX(-100%);
}

.nav-section {
    margin-bottom: 32px;
}

.nav-section-title {
    padding: 0 32px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(255,255,255,0.6);
    letter-spacing: 1px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 32px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid transparent;
    font-size: 15px;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
}

.nav-item.active {
    background: rgba(74, 222, 128, 0.15);
    border-left-color: #4ade80;
    color: #4ade80;
}

.nav-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* ===== 主要內容區 - 響應式 ===== */
.content {
    flex: 1;
    padding: var(--padding-desktop);
    overflow-y: auto;
    background: #f8fafb;
}

.page-header {
    margin-bottom: 32px;
}

.page-title {
    font-size: 36px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
}

.page-subtitle {
    color: #6b7280;
    font-size: 18px;
    font-weight: 400;
}

/* ===== 頁面切換樣式 ===== */
.page-content {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.page-content.active {
    display: block;
}

/* ===== 統計卡片 - 響應式 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--card-gap-desktop);
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border-left: 6px solid;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.1);
}

.stat-card.sales { border-left-color: #10b981; }
.stat-card.inventory { border-left-color: #3b82f6; }
.stat-card.alerts { border-left-color: #f59e0b; }
.stat-card.performance { border-left-color: #8b5cf6; }

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.stat-title {
    color: #6b7280;
    font-size: 16px;
    font-weight: 600;
}

.stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.stat-value {
    font-size: 42px;
    font-weight: 800;
    color: #1f2937;
    margin-bottom: 8px;
    line-height: 1;
}

.stat-change {
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.stat-change.positive { color: #10b981; }
.stat-change.negative { color: #ef4444; }

/* ===== 主要內容網格 - 響應式 ===== */
.main-content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
    min-height: 600px;
}

.left-column, .right-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ===== 右側欄位 ===== */
.right-column {
    min-height: 100%;
}

/* ===== 明星商品區 ===== */
.bestsellers-section {
    background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.bestsellers-title {
    font-size: 24px;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.bestsellers-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bestseller-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s;
}

.bestseller-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.bestseller-rank {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
}

.bestseller-info {
    flex: 1;
}

.bestseller-name {
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 4px;
    font-size: 16px;
}

.bestseller-sales {
    font-size: 14px;
    color: #10b981;
    font-weight: 600;
}

/* ===== 庫存警告區 ===== */
.alerts-section {
    background: white;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    flex: 1;
}

.alerts-title {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #fef2f2;
    border-left: 4px solid #ef4444;
    border-radius: 8px;
    margin-bottom: 12px;
}

.alert-icon {
    color: #ef4444;
    font-size: 18px;
}

.alert-text {
    flex: 1;
    font-size: 14px;
    color: #7f1d1d;
}

/* ===== 即將推出樣式 ===== */
.coming-soon {
    background: white;
    border-radius: 20px;
    padding: 60px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-top: 40px;
}

.coming-soon h3 {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 12px;
}

.coming-soon p {
    color: #6b7280;
    font-size: 18px;
}

/* ===== 通知系統 ===== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-left: 4px solid;
    z-index: 2000;
    transform: translateX(400px);
    transition: all 0.3s ease;
    max-width: 350px;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    border-left-color: #10b981;
}

.notification.error {
    border-left-color: #ef4444;
}

.notification.info {
    border-left-color: #3b82f6;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification-icon {
    font-size: 20px;
}

.notification-text {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.notification-message {
    font-size: 14px;
    color: #6b7280;
}

/* ===== 動畫效果 ===== */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.bounce-in {
    animation: bounceIn 0.5s ease-out;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

/* ===== 滾動條美化 ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}