/* 与admin/dashboard.php完全一致的样式 */
body {
    margin: 0;
    font-family: Arial, sans-serif;
}

.header {
    background: #1e88e5;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
}

.user-menu {
    position: relative;
}

.user-avatar {
    cursor: pointer;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 55px;
    background: white;
    min-width: 280px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 8px 16px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.dropdown-menu.show {
    display: block;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 20px;
    width: 16px;
    height: 16px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: none;
    border-right: none;
    transform: rotate(45deg);
    z-index: -1;
}

.dropdown-menu .dropdown-item {
    color: #374151;
    padding: 14px 20px;
    text-decoration: none;
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
}

.dropdown-item:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    color: #1e40af;
    transform: translateX(4px);
}

.dropdown-item i {
    margin-right: 12px;
    width: 18px;
    text-align: center;
    font-size: 16px;
    opacity: 0.7;
    transition: all 0.2s ease;
}

.dropdown-item:hover i {
    opacity: 1;
    color: #1e40af;
}

.user-menu:hover .dropdown-menu {
    display: block;
}

.sidebar {
    width: 200px;
    background: #f5f5f5;
    flex-shrink: 0;
    height: calc(100vh - 50px);
    overflow-y: auto;
    transition: transform 0.3s ease;
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    .sidebar {
        position: fixed;
        top: 50px; /* 调整为与顶部菜单栏高度一致 */
        left: 0;
        width: 180px;
        height: calc(100vh - 50px); /* 调整高度计算 */
        transform: translateX(-100%);
        z-index: 1000;
        box-shadow: 2px 0 5px rgba(0,0,0,0.1);
        float: none;
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .content {
        padding: 15px 0;
        width: 100%;
        box-sizing: border-box;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    .sidebar-overlay.active {
        display: block;
    }
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar li a {
    display: block;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
}

.sidebar li a:hover {
    background: #e0e0e0;
}

.sidebar li a.active {
    background: #1e88e5;
    color: white;
}

/* 首页导航项特殊样式 */
.sidebar li:first-child a.active {
    background: #e0e0e0;
    color: #333;
}

.sidebar li a i {
    width: 24px;
    text-align: center;
    margin-right: 10px;
}

.content {
    flex: 1;
    padding: 20px;
    min-width: 0;
    box-sizing: border-box;
}

.user-menu {
    position: relative;
    display: inline-block;
}

.user-menu:hover .dropdown {
    display: block;
}

.dropdown {
    display: none;
    position: absolute;
    right: 0;
    background: white;
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    z-index: 1;
}

.dropdown a {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
}

.dropdown a:hover {
    background: #f1f1f1;
}

.user-info {
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
}

.user-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8, #7c3aed);
}

.user-account, .login-validity {
        margin-bottom: 12px;
        font-size: 13px !important; /* 调整字体大小 */
        color: #4b5563;
        display: flex;
        align-items: center;
        line-height: 1.5;
        font-weight: 500;
        transition: all 0.2s ease;
    }

    .dropdown-menu .user-account span,
    .dropdown-menu .login-validity span,
    .dropdown-menu .balance-info .balance-label,
    .dropdown-menu .balance-info .balance-amount {
        font-size: 13px !important;
    }

.user-account:last-child, .login-validity:last-child {
    margin-bottom: 0;
}

.user-account:hover, .login-validity:hover {
    color: #1f2937;
    transform: translateX(2px);
}

.user-account i, .login-validity i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
    color: #6366f1;
    font-size: 16px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 6px;
    padding: 4px;
    transition: all 0.2s ease;
}

.user-account:hover i, .login-validity:hover i {
    background: rgba(99, 102, 241, 0.2);
    transform: scale(1.1);
}

.user-account span:last-child, .login-validity span:last-child {
    font-weight: 600;
    color: #1f2937;
}

.dropdown-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.1), transparent);
    margin: 0;
    border: none;
}

/* 页面内容区域 */
.page-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.content-page {
    display: none;
}

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

/* 首页样式 */
.welcome-section {
    text-align: center;
    margin-bottom: 40px;
}

.welcome-section h2 {
    font-size: 32px;
    color: #2c3e50;
    margin-bottom: 10px;
}

.welcome-section p {
    font-size: 16px;
    color: #7f8c8d;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    background: linear-gradient(135deg, #3498db, #2980b9);
}

.stat-info h3 {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 5px;
    font-weight: 500;
}

.stat-number {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
}

/* 订单管理页面样式 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h2 {
    font-size: 28px;
    color: #2c3e50;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2980b9, #1f5f8b);
    transform: translateY(-1px);
}

.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.data-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.data-table tbody tr:hover {
    background-color: #f8f9fa;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-completed {
    background-color: #d4edda;
    color: #155724;
}

.btn-icon {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    color: #666;
    transition: all 0.3s ease;
    margin-right: 5px;
}

.btn-icon:hover {
    background-color: #f8f9fa;
    color: #3498db;
}

/* 移动端遮罩层 */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    
    .main-content {
        margin-left: 240px;
    }
    
    .page-content {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .dropdown-menu {
        min-width: 260px;
        right: -10px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 180px !important; /* 调整宽度并添加!important进行诊断 */
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .top-header {
        padding: 0 15px;
        height: 50px; /* 调整高度 */
    }
    .header {
        padding: 10px 15px; /* 减小顶部菜单栏的垂直内边距 */
    }
    
    .page-title {
        font-size: 20px;
    }
    
    .page-content {
        padding: 15px;
    }
    
    .welcome-section h2 {
        font-size: 24px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .page-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .data-table {
        min-width: 600px;
    }
    
    .user-avatar .user-name {
        display: none;
    }
    .user-menu {
        margin-right: 20px; /* 移动用户头像向左 */
    }
    
    /* 移动端下拉菜单优化 */
    .dropdown-menu {
        min-width: 250px;
        right: 10px; /* 调整为距离右侧10px */
        top: 50px;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2), 0 5px 15px rgba(0, 0, 0, 0.15);
    }
    
    .dropdown-menu::before {
        right: 30px;
    }
    
    .user-info {
        padding: 18px;
    }
    
    .dropdown-menu .dropdown-item {
        padding: 16px 20px;
        font-size: 14px !important; /* 调整字体大小 */
    }
}

@media (max-width: 768px) {
    .sidebar li a {
        padding: 12px 15px; /* 减小内边距 */
    }
    .sidebar li a i {
        width: 20px; /* 减小图标宽度 */
        margin-right: 8px; /* 减小图标右侧间距 */
    }
}

@media (max-width: 480px) {
    .top-header {
        padding: 0 10px;
    }
    .header {
        padding: 8px 10px; /* 进一步减小顶部菜单栏的垂直内边距 */
    }
    
    .page-content {
        padding: 10px;
    }
    
    .stat-card {
        padding: 15px;
        gap: 15px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .stat-number {
        font-size: 20px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px;
        font-size: 14px;
    }
    
    /* 小屏幕下拉菜单优化 */
    .dropdown-menu {
        min-width: 220px;
        right: 10px; /* 调整为距离右侧10px */
        left: auto;
        transform-origin: top right;
    }
    
    .dropdown-menu::before {
        right: 40px;
    }
    
    .user-info {
        padding: 16px;
    }
    
    .user-account, .login-validity {
        font-size: 12px !important;
        margin-bottom: 10px;
    }

    .dropdown-menu .user-account span,
    .dropdown-menu .login-validity span,
    .dropdown-menu .balance-info .balance-label,
    .dropdown-menu .balance-info .balance-amount {
        font-size: 12px !important;
    }
    
    .dropdown-menu .dropdown-item {
        padding: 14px 18px;
        font-size: 13px !important; /* 调整字体大小 */
    }
    .sidebar li a {
        padding: 10px 12px; /* 进一步减小内边距 */
    }
    .sidebar li a i {
        width: 18px; /* 进一步减小图标宽度 */
        margin-right: 6px; /* 进一步减小图标右侧间距 */
    }
    
    .user-avatar {
        width: 36px;
        height: 36px;
    }
    .user-menu {
        margin-right: 15px; /* 移动用户头像向左 */
    }
    .sidebar {
        width: 150px; /* 调整宽度 */
    }
}

/* 动画效果 */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-page.active {
    animation: slideIn 0.3s ease;
}

/* 滚动条样式 */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* 最新公告卡片样式 */
.layout-wrapper {
    display: flex;
    flex-direction: row;
    min-height: calc(100vh - 50px);
}

.announcement-section {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    overflow: hidden;
    margin-top: 0;
    width: 100%;
    box-sizing: border-box;
}
.section-header {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}
.section-header h2 {
    margin: 0;
    font-size: 16px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-header h2 i { color: #1e88e5; }

.announcement-list { padding: 10px; }

.announcement-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}
.announcement-card:last-child { border-bottom: none; }
.announcement-card:hover { background: #f8f9fa; }

.announcement-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e3f2fd;
    color: #1e88e5;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.announcement-body { flex: 1; min-width: 0; }
.announcement-title {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.announcement-excerpt {
    font-size: 13px;
    color: #888;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.announcement-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
    font-size: 12px;
    color: #aaa;
}
.announcement-meta i { margin-right: 3px; }

.announcement-loading,
.announcement-empty {
    text-align: center;
    padding: 30px;
    color: #999;
    font-size: 14px;
}
.announcement-empty i { font-size: 32px; margin-bottom: 10px; color: #ddd; }

@media (max-width: 768px) {
    .layout-wrapper {
        flex-direction: column;
    }
    .announcement-section {
        border-radius: 0;
        margin: 0;
        width: 100%;
        box-shadow: none;
        border-top: 1px solid #eee;
        border-bottom: 1px solid #eee;
    }
    .section-header {
        padding: 12px 15px;
        background: #fff;
    }
    .section-header h2 {
        font-size: 17px;
    }
    .announcement-list { padding: 0; }
    .announcement-card {
        padding: 12px 0;
        gap: 0;
        padding-left: 50px;
        position: relative;
    }
    .announcement-card .announcement-icon {
        position: absolute;
        left: 10px;
        top: 12px;
        width: 30px;
        height: 30px;
        font-size: 13px;
    }
    .announcement-title {
        font-size: 14px;
        font-weight: 600;
        -webkit-line-clamp: 1;
    }
    .announcement-excerpt {
        font-size: 12px;
        color: #999;
        -webkit-line-clamp: 1;
    }
    .announcement-meta {
        font-size: 11px;
        color: #bbb;
        gap: 8px;
        margin-top: 4px;
    }
}

/* 公告详情模态框 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal-content.modal-announcement {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 560px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.25s ease-out;
}
.modal-announcement .modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
    border-radius: 12px 12px 0 0;
    position: sticky;
    top: 0;
    z-index: 1;
}
.modal-announcement .modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #2c3e50;
    flex: 1;
    padding-right: 10px;
}
.modal-announcement .modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    padding: 0;
    line-height: 1;
}
.modal-announcement .modal-close:hover { color: #333; }
.modal-announcement .modal-body { padding: 20px; }
.modal-announcement-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #999;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}
.modal-announcement-meta i { margin-right: 4px; }
.modal-announcement-content {
    font-size: 15px;
    color: #333;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
}
.modal-announcement .modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #eee;
    text-align: right;
}
.modal-announcement .modal-footer .btn {
    padding: 8px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    background: #1e88e5;
    color: white;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .modal-content.modal-announcement {
        width: 95%;
        max-height: 85vh;
        border-radius: 8px;
    }
    .modal-announcement .modal-header { padding: 14px 16px; }
    .modal-announcement .modal-body { padding: 16px; }
    .modal-announcement-content { font-size: 14px; }
}

/* 余额显示样式 */
.balance-info {
    margin-bottom: 12px;
    font-size: 14px;
    color: #4b5563;
    display: flex;
    align-items: center;
    line-height: 1.5;
    padding: 8px 12px;
    background-color: #f0f9ff;
    border-radius: 6px;
    border-left: 3px solid #0ea5e9;
}

.balance-info i {
    color: #0ea5e9;
    margin-right: 8px;
    font-size: 16px;
}

.balance-label {
    color: #6b7280;
    margin-right: 5px;
}

.balance-amount {
    color: #0ea5e9;
    font-weight: 600;
    font-size: 15px;
    font-family: 'Courier New', monospace;
}