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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 100vh;
    color: #333;
    transition: background 0.5s ease;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
}

/* When main has a custom background, make it cover the main area */
.container .main.custom-bg {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* add a subtle overlay to improve text contrast */
    position: relative;
}
.container .main.custom-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.25);
    pointer-events: none;
    z-index: 0;
}
.container .main.custom-bg > * {
    position: relative;
    z-index: 1;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    /* glass background */
    background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.06));
    padding: 50px 25px 25px 25px;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px) saturate(120%);
    -webkit-backdrop-filter: blur(8px) saturate(120%);
    border: 1px solid rgba(255,255,255,0.08);
    position: relative;
}

.bg-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.bg-control-btn {
    padding: 6px 12px;
    background: #4a5568;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.bg-control-btn:hover {
    background: #2d3748;
}

.bg-upload {
    display: none;
}

.header h1 {
    font-size: 2.8rem;
    font-weight: 800;
    color: #ffffffc1;
    margin-bottom: 10px;
    text-shadow: 0 6px 20px rgba(0,0,0,0.6);
}

.subtitle {
    font-size: 1.1rem;
    color: #718096;
    margin-bottom: 30px;
}

.filters {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    background: #4a5568;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.filter-btn:hover {
    background: #2d3748;
    transform: translateY(-2px);
}

.filter-btn.active {
    background: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* glass */
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(6px) saturate(110%);
    -webkit-backdrop-filter: blur(6px) saturate(110%);
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 0.85rem;
    color: #4a5568;
    border: 1px solid rgba(255,255,255,0.06);
}

.conferences-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 15px;
    max-width: 1400px;
    margin: 0 auto;
}

.empty-state {
    grid-column: 1 / -1;
    padding: 36px 24px;
    border-radius: 14px;
    text-align: center;
    color: rgba(255, 255, 255, 0.92);
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(6px) saturate(110%);
    -webkit-backdrop-filter: blur(6px) saturate(110%);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

/* 强制最大4列 */
@media (min-width: 1400px) {
    .conferences-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 大屏幕3列 */
@media (min-width: 1000px) and (max-width: 1399px) {
    .conferences-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 中等屏幕2列 */
@media (min-width: 700px) and (max-width: 999px) {
    .conferences-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 小屏幕1列 */
@media (max-width: 699px) {
    .conferences-grid {
        grid-template-columns: 1fr;
    }
}

.conference-card {
    /* glass-style card */
    background: rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
    transition: all 0.3s ease;
    border-left: 4px solid #667eea;
    backdrop-filter: blur(6px) saturate(110%);
    -webkit-backdrop-filter: blur(6px) saturate(110%);
    border: 1px solid rgba(255,255,255,0.04);
    min-height: 280px;
    height: auto;
    display: flex;
    flex-direction: column;
}

.conference-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.conference-card.ccf-a {
    border-left-color: #f56565;
}

.conference-card.ccf-b {
    border-left-color: #ed8936;
}

.conference-card.ccf-c {
    border-left-color: #38b2ac;
}

.conference-card.non-ccf {
    border-left-color: #9f7aea;
}

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

.conference-name {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 5px;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.3s ease;
}

.conference-name:hover {
    color: #4299e1;
    text-decoration: underline;
}

.conference-full-name {
    font-size: 0.9rem;
    color: #718096;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Make card titles more visible on dark/glass backgrounds */
.conference-card .conference-name {
    color: #ffffff;
    font-weight: 800;
    font-size: 1.36rem;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
.conference-card .conference-full-name {
    color: rgba(255,255,255,0.88);
}

/* In timeline view, make the full conference name / extra info more subtle */
.timeline-content .conference-full-name,
.timeline-content .conference-extra {
    color: rgba(255,255,255,0.72);
    font-weight: 500;
}

.ccf-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
}

.ccf-badge.ccf-a {
    background: #f56565;
}

.ccf-badge.ccf-b {
    background: #ed8936;
}

.ccf-badge.ccf-c {
    background: #38b2ac;
}

.ccf-badge.non-ccf {
    background: #9f7aea;
}

.conference-details {
    margin-bottom: 15px;
    flex: 1;
    overflow: hidden;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.85rem;
}

.detail-label {
    color: #4a5568;
    font-weight: 500;
    flex-shrink: 0;
}

.detail-value {
    color: #2d3748;
    text-align: right;
    flex: 1;
    margin-left: 10px;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

.countdown {
    text-align: center;
    padding: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 8px;
    color: white;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.countdown-value {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 3px;
}

.countdown-label {
    font-size: 0.8rem;
    opacity: 0.9;
}

.deadline-info {
    text-align: center;
    font-size: 0.8rem;
    color: #4a5568;
    margin-bottom: 12px;
}

.website-link {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
}

.conference-tag {
    display: inline-block;
    padding: 3px 6px;
    background: rgba(255,255,255,0.08);
    color: #4a5568;
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.04);
}

.conference-tag:hover {
    background: rgba(255,255,255,0.12);
    transform: translateY(-1px);
}

.footer {
    text-align: center;
    margin-top: 50px;
    padding: 30px;
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 15px;
    color: #718096;
    font-size: 0.9rem;
    line-height: 1.6;
    border: 1px solid rgba(255,255,255,0.04);
}

.expired {
    opacity: 0.6;
}

.expired .countdown {
    background: #a0aec0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header {
        padding: 60px 15px 25px 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .bg-controls {
        top: 10px;
        right: 10px;
        flex-direction: column;
        gap: 5px;
    }
    
    .bg-control-btn {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
    
    .conferences-grid {
        grid-template-columns: 1fr;
    }
    
    .info-bar {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .conference-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .detail-row {
        flex-direction: column;
        gap: 5px;
    }
    
    .detail-value {
        text-align: left;
        margin-left: 0;
    }
}

/* 时间轴样式（用于 '全部' 视图） */
/* 简化时间轴样式（恢复到方案A之前的轻量外观） */
.timeline-month-section {
    grid-column: 1 / -1;
    position: relative;
    --axis-left: 80px; /* axis distance from section left */
    --section-padding-left: 120px; /* space reserved for axis and nodes */
    padding-left: var(--section-padding-left);
    margin-bottom: 28px;
}

.timeline-month-title { color: #fff; font-size:1.4rem; margin-bottom:12px; }

.timeline-month-section::before {
    content: '';
    position: absolute;
    left: var(--axis-left);
    top: 48px;
    bottom: 16px;
    width: 2px;
    background: rgba(255,255,255,0.16);
    z-index: 0;
}

.timeline-item { position: relative; display:flex; gap:18px; align-items:flex-start; padding:14px 0; z-index:1; }

.timeline-date {
    position: absolute;
    /* compute negative offset relative to .timeline-item: axis-left - section-padding-left */
    left: calc(var(--axis-left) - var(--section-padding-left));
    top: 50%;
    transform: translate(-50%, -50%);
    background: #4c6ef5;
    color: #fff;
    padding: 6px 8px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    z-index: 2;
    box-shadow: 0 6px 12px rgba(0,0,0,0.25);
}

.timeline-node { display:none; }

.timeline-content { background: transparent; padding: 6px 0 6px 40px; color: #fff; flex:1; }
.timeline-content .conference-name { font-weight:800; color:#fff; }
.conference-extra { color: rgba(255,255,255,0.9); margin-top:4px; }
.conference-location { color: rgba(255,255,255,0.95); font-weight:700; margin-top:6px; }

@media (max-width:700px){ 
    .timeline-month-section { --section-padding-left: 80px; --axis-left: 56px; }
    .timeline-date{ left: calc(var(--axis-left) - var(--section-padding-left)); transform: translate(-50%,-50%); }
    .timeline-content{ padding-left: 28px; }
}
