/**
 * 後台管理 - 佈局樣式
 * Admin Layout Styles (Header, Sidebar, Main Container)
 * 黑金/白金主題 (Black-Gold / White-Gold Theme)
 */

/* ==================== Header ==================== */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(180deg, rgba(18, 16, 12, 0.98) 0%, rgba(12, 10, 8, 0.99) 100%);
    border-bottom: 1px solid rgba(212, 165, 32, 0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(212, 165, 32, 0.05) inset;
    gap: 1rem;
}

.light-theme .admin-header {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 253, 248, 0.95) 100%);
    border-bottom: 1px solid rgba(184, 134, 11, 0.15);
    box-shadow: 0 4px 20px rgba(184, 134, 11, 0.08), 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.admin-header .header__left {
    display: flex;
    align-items: center;
    flex-shrink: 1;
    min-width: 0;
}

.admin-header .header__right {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
}

.admin-page .sidebar-toggle {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 1rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.admin-page .sidebar-toggle:hover {
    background-color: rgba(212, 165, 32, 0.1);
    color: var(--admin-primary);
}

.admin-page.light-theme .sidebar-toggle:hover {
    background-color: rgba(184, 134, 11, 0.08);
    color: var(--admin-primary-dark);
}

.admin-header .header__logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    min-width: 0;
}

.admin-header .header__logo img {
    height: 2rem;
    width: auto;
    flex-shrink: 0;
}

.admin-header .header__logo h1 {
    font-size: 1.25rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.light-theme .admin-header .header__logo h1 {
    background: linear-gradient(135deg, #1f1f1f 0%, #b8860b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.admin-header .header__logo h1 span {
    font-size: 0.875rem;
}

/* Header 圖標按鈕 */
.admin-header .header__icon {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: inherit;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.25rem;
    padding: 0;
    line-height: 1;
}

.admin-header .header__icon:hover {
    background-color: rgba(212, 165, 32, 0.15);
    color: var(--admin-primary);
}

.admin-header .header__icon i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
}

.light-theme .admin-header .header__icon:hover {
    background-color: rgba(184, 134, 11, 0.1);
    color: var(--admin-primary-dark);
}

/* 主題切換按鈕 */
.admin-header .theme-toggle {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: inherit;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.25rem;
    padding: 0;
    line-height: 1;
}

.admin-header .theme-toggle i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
}

.admin-header .theme-toggle:hover {
    background-color: rgba(212, 165, 32, 0.15);
    color: var(--admin-primary);
}

.light-theme .admin-header .theme-toggle:hover {
    background-color: rgba(184, 134, 11, 0.1);
    color: var(--admin-primary-dark);
}

/* 管理員資訊 */
.admin-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-right: 1rem;
    font-size: 0.875rem;
}

.admin-name {
    font-weight: 600;
    color: var(--admin-primary);
}

.light-theme .admin-name {
    color: var(--admin-primary-dark);
}

.admin-role {
    font-size: 0.75rem;
    color: #888;
}

.light-theme .admin-role {
    color: var(--admin-text-secondary);
}

/* ==================== 主容器佈局 ==================== */
.admin-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* ==================== 側邊欄動畫 ==================== */
@keyframes adminNavItemFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== 側邊欄 (後台專用) ==================== */
.admin-page .sidebar {
    width: 16rem;
    background: linear-gradient(180deg, rgba(18, 16, 12, 0.98) 0%, rgba(12, 10, 8, 0.99) 100%);
    border-right: 1px solid rgba(212, 165, 32, 0.1);
    transition: width 0.3s ease;
    overflow-y: auto;
    flex-shrink: 0;
}

.admin-page.light-theme .sidebar {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 246, 240, 0.99) 100%);
    border-right: 1px solid rgba(184, 134, 11, 0.12);
}

.admin-page .sidebar.collapsed {
    width: 4rem;
}

.admin-page .sidebar.collapsed .nav-link span {
    display: none;
}

.admin-page .sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 1rem;
}

.admin-page .sidebar.collapsed .nav-link i {
    margin-right: 0;
    font-size: 1.25rem;
}

/* 側邊欄咖啡按鈕 */
.admin-page .sidebar-coffee {
    padding: 1rem;
    margin-top: auto;
    border-top: 1px solid rgba(212, 165, 32, 0.1);
    transform: scale(0.72);
    transform-origin: left center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.admin-page.light-theme .sidebar-coffee {
    border-top-color: rgba(184, 134, 11, 0.1);
}

.admin-page .sidebar.collapsed .sidebar-coffee {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    pointer-events: none;
}

/* 側邊欄遮罩 */
.admin-page .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1400;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.admin-page .sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.admin-page .sidebar-nav {
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.admin-page .nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.admin-page .nav-item {
    margin: 0.25rem 0.5rem;
}

/* 側邊欄切換動畫 - 隱藏階段 */
.admin-page .sidebar.sidebar--hiding .nav-item {
    opacity: 0 !important;
    visibility: hidden !important;
    transition: none !important;
}

/* 側邊欄切換動畫 - 動畫階段 */
.admin-page .sidebar.sidebar--animating .nav-item {
    animation: adminNavItemFadeIn 0.2s ease-out backwards;
}

/* 由下往上依序出現的延遲 */
.admin-page .sidebar.sidebar--animating .nav-item:nth-child(11) { animation-delay: 0s; }
.admin-page .sidebar.sidebar--animating .nav-item:nth-child(10) { animation-delay: 0.02s; }
.admin-page .sidebar.sidebar--animating .nav-item:nth-child(9) { animation-delay: 0.04s; }
.admin-page .sidebar.sidebar--animating .nav-item:nth-child(8) { animation-delay: 0.06s; }
.admin-page .sidebar.sidebar--animating .nav-item:nth-child(7) { animation-delay: 0.08s; }
.admin-page .sidebar.sidebar--animating .nav-item:nth-child(6) { animation-delay: 0.1s; }
.admin-page .sidebar.sidebar--animating .nav-item:nth-child(5) { animation-delay: 0.12s; }
.admin-page .sidebar.sidebar--animating .nav-item:nth-child(4) { animation-delay: 0.14s; }
.admin-page .sidebar.sidebar--animating .nav-item:nth-child(3) { animation-delay: 0.16s; }
.admin-page .sidebar.sidebar--animating .nav-item:nth-child(2) { animation-delay: 0.18s; }
.admin-page .sidebar.sidebar--animating .nav-item:nth-child(1) { animation-delay: 0.2s; }

.admin-page .nav-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    color: #b0b0b0;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.admin-page .nav-link i {
    width: 1.5rem;
    margin-right: 0.75rem;
    font-size: 1.125rem;
    text-align: center;
}

.admin-page .nav-link:hover {
    background: linear-gradient(90deg, rgba(212, 165, 32, 0.1) 0%, transparent 100%);
    color: var(--admin-gold-light);
    border-left: 3px solid rgba(212, 165, 32, 0.5);
}

.admin-page .nav-link.active {
    background: linear-gradient(90deg, rgba(212, 165, 32, 0.2) 0%, rgba(184, 134, 11, 0.1) 100%);
    color: var(--admin-primary);
    border-left: 3px solid var(--admin-primary);
}

.admin-page.light-theme .nav-link {
    color: #666;
}

.admin-page.light-theme .nav-link:hover {
    background: linear-gradient(90deg, rgba(184, 134, 11, 0.08) 0%, transparent 100%);
    color: var(--admin-primary-dark);
    border-left: 3px solid rgba(184, 134, 11, 0.5);
}

.admin-page.light-theme .nav-link.active {
    background: linear-gradient(90deg, rgba(184, 134, 11, 0.12) 0%, rgba(139, 105, 20, 0.06) 100%);
    color: var(--admin-primary-dark);
    border-left: 3px solid var(--admin-primary-dark);
}

/* ==================== 主內容區域 ==================== */
.admin-main {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background-color: transparent;
    position: relative;
}

.admin-page.sidebar-collapsed .admin-main {
    margin-left: 0;
}

/* 頁面內容 */
.page-content {
    animation: fadeIn 0.3s ease;
}

.page-content.hidden {
    display: none;
}

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

/* 頁面標題 */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-header h2 i {
    color: var(--admin-primary);
}

.light-theme .page-header h2 i {
    color: var(--admin-primary-dark);
}

.page-subtitle {
    color: #888;
    font-size: 0.875rem;
    margin: 0;
}

.light-theme .page-subtitle {
    color: var(--admin-text-secondary);
}
