:root {
    --primary-color: #0f172a;
    --secondary-color: #1e293b;
    --accent-color: #3b82f6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f8fafc;
    --sidebar-width: 260px;
    --header-height: 70px;
    --card-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
    --hover-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--primary-color);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Layout Wrapper */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Header Logo (Moved from Sidebar) */
.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-right: 30px;
}

.header-logo i {
    color: var(--accent-color);
}

/* Main Content */
.main-content {
    flex-grow: 1;
    min-width: 0;
}

.top-header {
    height: var(--header-height);
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 90;
}

.header-main-row {
    display: flex;
    align-items: center;
    gap: 30px;
}

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

.header-logo i {
    font-size: 1.8rem;
}

.search-bar {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    padding: 8px 15px;
    border-radius: 10px;
    width: 350px;
    gap: 10px;
}

.search-bar input {
    background: none;
    border: none;
    outline: none;
    width: 100%;
    font-size: 0.9rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 12px;
    transition: var(--transition);
}

.user-profile:hover {
    background: #f1f5f9;
}

.user-profile img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 8px;
    margin-top: 5px;
    display: none;
    min-width: 160px;
    border: 1px solid #f1f5f9;
    z-index: 1000;
    transform-origin: top right;
    animation: dropdownFade 0.2s ease-out;
}

/* 增加透明热区，防止鼠标滑出时菜单消失 */
.user-dropdown::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 0;
    width: 100%;
    height: 15px;
}

@keyframes dropdownFade {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

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

#logout-btn {
    width: 100%;
    padding: 12px 15px;
    border: none;
    background: none;
    color: var(--danger-color);
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

#logout-btn:hover {
    background: #fee2e2;
}

.dashboard-content {
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.welcome-section {
    margin-bottom: 35px;
}

.welcome-section h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 5px;
}

.welcome-section p {
    color: #64748b;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--hover-shadow);
}

.stat-icon {
    width: 55px;
    height: 55px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.blue { background: #eff6ff; color: #3b82f6; }
.stat-icon.green { background: #ecfdf5; color: #10b981; }
.stat-icon.yellow { background: #fffbeb; color: #f59e0b; }
.stat-icon.purple { background: #faf5ff; color: #8b5cf6; }

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
}

/* Project Section */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.filter-tabs {
    display: flex;
    background: #e2e8f0;
    padding: 4px;
    border-radius: 10px;
    gap: 4px;
}

.filter-btn {
    padding: 8px 20px;
    border: none;
    background: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    color: #64748b;
}

.filter-btn.active {
    background: white;
    color: var(--accent-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* Project Grid & Cards */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.project-card {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: 1px solid #f1f5f9;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--hover-shadow);
    border-color: var(--accent-color);
}

.project-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: var(--accent-color);
}

.project-card.completed::after { background: var(--success-color); }
.project-card.cancelled::after { background: var(--danger-color); }

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.project-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.4;
    padding-right: 15px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-completed { background: #d1fae5; color: #065f46; }
.status-cancelled { background: #fee2e2; color: #991b1b; }
.status-active { background: #dbeafe; color: #1e40af; }

.project-info {
    display: grid;
    gap: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.info-item .label {
    color: #64748b;
}

.info-item .value {
    font-weight: 600;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: white;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    border-radius: 24px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.close-button {
    position: absolute;
    top: 25px;
    right: 25px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: #64748b;
    transition: var(--transition);
    z-index: 10;
}

.close-button:hover {
    background: #e2e8f0;
    color: var(--primary-color);
    transform: rotate(90deg);
}

#modal-body {
    padding: 40px;
    overflow-y: auto;
}

/* Modal Detail Header */
.detail-header {
    margin-bottom: 35px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 25px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.title-area h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.title-area .description {
    color: #64748b;
    font-size: 1.1rem;
    max-width: 80%;
}

.header-content .status-badge {
    font-size: 0.9rem;
    padding: 8px 20px;
    border-radius: 10px;
}

/* Detail Grid Layout */
.detail-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 40px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
}

.section-title i {
    color: var(--accent-color);
}

/* Summary Card */
.summary-card {
    background: #f8fafc;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-row .label {
    color: #64748b;
    font-size: 0.95rem;
}

.info-row .value {
    font-weight: 600;
    color: var(--primary-color);
}

.info-row .value.highlight {
    font-size: 1.1rem;
    color: var(--accent-color);
    font-weight: 700;
}

/* Winner Card */
.winner-card {
    background: #ecfdf5;
    border: 1px solid #10b981;
    border-radius: 16px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.winner-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #065f46;
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.winner-info .winner-label {
    font-size: 0.8rem;
    color: #065f46;
    opacity: 0.8;
    margin-bottom: 4px;
}

.winner-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #065f46;
}

.winner-price {
    font-size: 1.6rem;
    font-weight: 800;
    color: #10b981;
}

/* Bid Timeline */
.bid-timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 10px;
}

.bid-item {
    background: #f8fafc;
    border-radius: 12px;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    border: 1px solid transparent;
}

.bid-item:hover {
    background: #f1f5f9;
}

.bid-item.is-winner {
    background: #ecfdf5;
    border-color: #10b981;
}

.bid-company {
    font-weight: 600;
    color: var(--primary-color);
    flex: 1;
}

.bid-amount-time {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bid-amount {
    font-weight: 700;
    color: var(--accent-color);
    font-size: 1.1rem;
}

.bid-item.is-winner .bid-amount {
    color: #10b981;
}

.bid-time {
    font-size: 0.8rem;
    color: #94a3b8;
}

.winner-indicator {
    background: #10b981;
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 15px;
}

.empty-history {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
    background: #f8fafc;
    border-radius: 12px;
}

/* Responsive Modal */
/* Footer Styles */
.app-footer {
    margin-top: auto;
    padding: 30px 40px;
    background: white;
    border-top: 1px solid #f1f5f9;
    color: #64748b;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 15px;
}

.footer-links span {
    white-space: nowrap; /* 防止系统名称断行 */
}

.footer-links .divider {
    color: #e2e8f0;
}

/* 移动端页脚专项优化 */
@media (max-width: 768px) {
    .app-footer {
        padding: 20px 15px;
    }

    .footer-content {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        font-size: 0.8rem;
    }

    .footer-links {
        flex-direction: column;
        gap: 5px;
    }

    .footer-links .divider {
        display: none; /* 移动端垂直排列，隐藏竖线分割符 */
    }
}
    
.modal-content {
    width: 95%;
    max-height: 95vh;
}

/* Loading State */
.loading-container {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- 响应式适配 --- */

/* 平板端 (1024px 以下) */
@media (max-width: 1024px) {
    .dashboard-content {
        padding: 30px 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 手机端 (768px 以下) */
@media (max-width: 768px) {
    .top-header {
        padding: 12px 15px;
        height: auto;
        display: grid;
        grid-template-areas: 
            "logo profile"
            "search search";
        gap: 12px;
        align-items: center;
    }

    .header-main-row {
        display: contents; /* 使子元素直接参与 grid 布局 */
    }

    .header-logo {
        grid-area: logo;
        margin-right: 0;
        font-size: 1.2rem;
    }

    .header-logo i {
        font-size: 1.4rem;
    }

    .search-bar {
        grid-area: search;
        width: 100%;
        margin-left: 0;
    }

    .user-profile {
        grid-area: profile;
        justify-content: flex-end;
        padding: 0;
    }

    #display-username {
        display: none; /* 移动端隐藏冗长的企业名称 */
    }

    .user-profile img {
        width: 32px;
        height: 32px;
    }

    .welcome-section h1 {
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .filter-tabs {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 5px;
    }

    .filter-btn {
        flex: 1;
        white-space: nowrap;
        padding: 8px 12px;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }

    /* 模态框移动端适配 */
    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        padding: 20px;
    }

    .detail-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .detail-header {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }

    .title-area h2 {
        font-size: 1.4rem;
    }

    .title-area .description {
        max-width: 100%;
        font-size: 0.95rem;
    }

    .bid-timeline {
        max-height: 400px;
    }

    /* 页脚适配 */
    .footer-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* 小屏手机 (480px 以下) */
@media (max-width: 480px) {
    .stat-card {
        padding: 15px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .bid-item {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .bid-amount-time {
        text-align: left;
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .winner-indicator {
        margin-left: 0;
    }
}
