/* ========================================
   layout.css - Badge Forge 布局样式
   版本: 2026-05-03
   依赖: variables.css, components.css
   ======================================== */

/* ========================================
   主布局
   ======================================== */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: calc(100vh - 120px);
}

/* ========================================
   导航栏
   ======================================== */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--card-border);
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky, 100);
    overflow: visible;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    gap: 1rem;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0.1rem;
    align-items: center;
    flex: 1;
    justify-content: center;
    flex-wrap: nowrap;
    overflow: hidden;
}

.nav-menu a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--duration-fast, 150ms) ease;
    padding: 0.5rem 0.5rem;
    border-radius: 6px;
    white-space: nowrap;
    display: block;
    font-size: 0.9rem;
}

.nav-menu a:hover {
    color: var(--primary-light);
    background: rgba(99, 102, 241, 0.1);
}

.nav-item {
    position: relative;
}

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

.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.nav-hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.admin-link {
    color: var(--warning) !important;
}

/* ========================================
   主题切换按钮
   ======================================== */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.theme-toggle:hover {
    background: var(--bg-card);
    transform: rotate(15deg);
}

.theme-icon {
    font-size: 16px;
}

/* ========================================
   用户下拉菜单
   ======================================== */
.user-dropdown {
    position: relative;
}

.user-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.user-dropdown-btn:hover {
    background: var(--bg-card);
    border-color: var(--primary);
}

.user-avatar {
    font-size: 16px;
}

/* ====== 导航栏迷你头像框 ====== */
.nav-avatar-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    position: relative;
    z-index: 1;
}
.nav-avatar-icon {
    font-size: 15px;
    line-height: 1;
}

/* 金框 */
.nav-avatar-wrapper.nav-frame-gold {
    box-shadow: 0 0 6px rgba(255, 215, 0, 0.7), inset 0 0 3px rgba(255, 215, 0, 0.2);
    border: 2px solid #ffd700;
    animation: navGoldPulse 2.5s ease-in-out infinite;
}
@keyframes navGoldPulse { 0%,100%{filter:brightness(1)}50%{filter:brightness(1.2)} }

/* 彩虹框 */
.nav-avatar-wrapper.nav-frame-rainbow {
    border: 2px solid transparent;
    background: linear-gradient(#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    animation: navRainbowSpin 3s linear infinite;
    box-shadow: 0 0 8px rgba(255, 80, 150, 0.5);
}
@keyframes navRainbowSpin { to { background: linear-gradient(360deg,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00) border-box; } }

/* 火焰框 */
.nav-avatar-wrapper.nav-frame-flame {
    border: 2px solid #ff6a00;
    box-shadow: 0 0 8px rgba(255, 80, 0, 0.65), 0 -3px 10px rgba(255, 120, 0, 0.5);
    animation: navFlameFlicker 0.4s ease-in-out infinite alternate;
}
@keyframes navFlameFlicker { 0%{transform:scale(1);opacity:.95}100%{transform:scale(1.04);opacity:1} }

/* ===== 导航栏锻造台皮肤迷你标识 ===== */
.nav-forge-skin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 12px;
    border-radius: 4px;
    margin-left: 2px;
}
/* 暗夜 */
.nav-forge-skin.nav-skin-dark {
    background: linear-gradient(135deg, #1a1a2e, #0f0f23);
    border: 1px solid #3a3a5a;
    box-shadow: 0 0 4px rgba(80, 80, 180, 0.2);
}
/* 霓虹 */
.nav-forge-skin.nav-skin-neon {
    border: 1px solid rgba(255,0,255,0.33);
    box-shadow: 0 0 6px rgba(255, 0, 255, 0.25);
    animation: navNeonPulse 2s ease-in-out infinite;
}
@keyframes navNeonPulse { 0%,100%{box-shadow:0 0 4px rgba(255,0,255,0.2)}50%{box-shadow:0 0 10px rgba(255,0,255,0.45)} }
/* 黄金 */
.nav-forge-skin.nav-skin-gold {
    border: 1px solid #daa520;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.35);
}

.user-name {
    font-weight: 500;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ====== 导航栏用户头像样式 ====== */
.user-avatar-nav {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary, #6366f1);
}

.user-avatar-placeholder {
    font-size: 16px;
    line-height: 1;
}

.user-nav-name {
    font-weight: 500;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.2s;
    opacity: 0.6;
}

.user-dropdown-btn:hover .dropdown-arrow {
    opacity: 1;
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: var(--z-dropdown, 50);
}

.user-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.15s;
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--bg-secondary);
}

.dropdown-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.dropdown-divider {
    height: 1px;
    background: var(--card-border);
    margin: 6px 0;
}

.dropdown-item-danger {
    color: var(--danger);
}

.dropdown-item-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.badge-admin {
    font-size: 1.1rem;
    cursor: default;
}

/* ========================================
   公告悬浮按钮
   ======================================== */
.announce-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
    transition: all 0.3s ease;
    z-index: var(--z-fab, 400);
    animation: fab-pulse 2s infinite;
}

.announce-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(245, 158, 11, 0.5);
}

.announce-fab .fab-icon {
    font-size: 28px;
}

.announce-fab .fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
    animation: badge-bounce 1s infinite;
}

@keyframes fab-pulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
    }
    50% {
        box-shadow: 0 4px 30px rgba(245, 158, 11, 0.6);
    }
}

@keyframes badge-bounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* ========================================
   模态框
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal, 210);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--card-border);
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: white;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: center;
}

.btn-confirm-modal {
    padding: 14px 40px;
    font-size: 16px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.btn-confirm-modal:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

.btn-confirm-modal:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ========================================
   公告内容
   ======================================== */
.announce-content .notices-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.announce-content .notice-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border-left: 4px solid #6366f1;
}

.announce-content .notice-warning {
    border-left-color: #f59e0b;
}

.announce-content .notice-success {
    border-left-color: #22c55e;
}

.announce-content .notice-danger {
    border-left-color: #ef4444;
}

.announce-content .notice-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.announce-content .notice-content h3 {
    margin: 0 0 8px 0;
    font-size: 15px;
    color: var(--text-primary);
}

.announce-content .notice-content p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.error-text {
    color: var(--danger);
    text-align: center;
    padding: 20px;
}

/* ========================================
   页脚
   ======================================== */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    border-top: 1px solid var(--card-border);
}

/* ========================================
   响应式布局
   ======================================== */
@media (max-width: 768px) {
    .nav-menu {
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 0.75rem 0.5rem;
    }
    .nav-brand {
        max-width: 100px;
        font-size: 0.9rem;
    }
}

/* ========================================
   二级导航菜单（Submenu）
   ======================================== */
.nav-item {
    position: relative;
}

.nav-item.has-submenu:hover .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.submenu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 160px;
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: var(--z-dropdown, 50);
    list-style: none;
}

.submenu li {
    margin: 0;
}

.submenu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.15s;
}

.submenu a:hover {
    background: var(--bg-secondary);
    color: var(--primary-light);
}

.submenu a.highlight {
    color: var(--primary);
    font-weight: 600;
}

.submenu a.highlight:hover {
    background: rgba(99, 102, 241, 0.1);
}
