/* Backend Admin Dashboard Styles */

:root {
    --primary-color: #4f46e5;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --header-height: 64px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
}

/* --- Header --- */
header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    white-space: nowrap;
}

.logo-img {
    height: 32px;
    width: auto;
    object-fit: contain;
}

/* 針對行動端的調整 */
@media (max-width: 480px) {
    .logo span {
        font-size: 0.9rem;
    }
    .logo-img {
        height: 28px;
    }
}

/* --- Navigation --- */
.nav-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 0.5rem;
}

/* 選單項樣式 */
.nav-item {
    position: relative;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: 0.2s;
}

.nav-link:hover,
.nav-item.active > .nav-link {
    color: var(--primary-color);
    background: #f1f5f9;
}

/* 下拉選單桌面端樣式 */
.dropdown-menu {
    position: absolute;
    top: 110%;
    left: 0;
    background: var(--bg-card);
    min-width: 180px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    list-style: none;
}

.dropdown-menu li a {
    padding: 0.6rem 1rem;
    text-decoration: none;
    color: var(--text-muted);
    display: block;
    font-size: 0.9rem;
    border-radius: 6px;
    transition: 0.2s;
}

.dropdown-menu li a:hover {
    background: #f8fafc;
    color: var(--primary-color);
    padding-left: 1.25rem;
}

/* 桌面端 Hover 顯示 */
@media (min-width: 769px) {
    .nav-item:hover .dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

/* --- RWD 手機版 --- */
.menu-toggle {
    display: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-main);
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        width: 100%;
        background: var(--bg-card);
        flex-direction: column;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
        max-height: calc(100vh - var(--header-height));
        overflow-y: auto;
    }

    .nav-links.active {
        display: flex;
    }

    /* 手機版下拉選單改為靜態展開 */
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        padding-left: 1.5rem;
        display: none;
        background: #fcfcfc;
    }

    .nav-item.open .dropdown-menu {
        display: block;
    }

    .nav-item.open .fa-chevron-down {
        transform: rotate(180deg);
    }
}

/* 主內容區保持寬敞 */
main {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

/* Avatar */
.avatar {
    width: 35px;
    height: 35px;
    background: #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-user-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}
