/* ============================================================
 * 页头：标题、导航按钮、账户下拉菜单
 * 文件：css/header.css
 * ============================================================ */

/* 头部 */
.header {
    background: linear-gradient(135deg, #2f2f2f, #2f2f2f);
    color: white;
    padding: 1rem 1rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    position: relative;
    /* 关键：让整个页头（含「我的账户」下拉菜单）压在轮播图上面。
       导航区用了 transform 定位，会自己形成一个层叠上下文，
       只给下拉菜单写 z-index 是没用的，必须让页头整体有个层级。 */
    z-index: 100;
    min-height: 90px;
}

.title-container {
    text-align: center;
    width: 100%;
    padding: 0.3rem 0;
}

.title {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    font-weight: bold;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.subtitle {
    font-size: clamp(0.8rem, 2vw, 1rem);
    opacity: 0.9;
}

/* 导航按钮 */
.nav-buttons {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: clamp(0.8rem, 2vw, 1.5rem);
    flex-wrap: wrap;
    justify-content: center;
    max-width: calc(100% - 2rem);
}

.nav-btn {
    padding: clamp(0.5rem, 1.5vw, 0.6rem) clamp(1rem, 2vw, 1.2rem);
    background-color: #444;
    color: white;
    border: 1px solid white;
    border-radius: 6px;
    font-size: clamp(0.9rem, 1.8vw, 1rem);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    min-width: 70px;
    text-align: center;
}

.nav-btn:hover {
    background-color: #989898;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border-color: #fff;
}

/* 下拉菜单 */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    padding: clamp(0.5rem, 1.5vw, 0.6rem) clamp(1rem, 2vw, 1.2rem);
    background-color: #669966;
    color: white;
    border: 1px solid white;
    border-radius: 6px;
    font-size: clamp(0.9rem, 1.8vw, 1rem);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    min-width: 100px;
    text-align: center;
}

.dropdown-btn:hover {
    background-color: #77aa77;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: #f9f9f9;
    min-width: 120px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 100;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 5px;
}

.dropdown-item {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 0.95rem;
}

.dropdown-item.username-item {
    background-color: #e8f5e9;
    font-weight: bold;
    color: #2e7d32;
    cursor: default;
}

.dropdown-item.username-item:hover {
    background-color: #e8f5e9;
}

.dropdown-item.action-item:hover {
    background-color: #f0f8ff;
    color: #2f2f2f;
}

.dropdown-content.show {
    display: block;
}
