/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

/* 广告容器样式 */
.ad-container {
    margin: 20px 0;
    text-align: center;
}

.ad-top {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    backdrop-filter: blur(10px);
}

.ad-sidebar {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 160px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    backdrop-filter: blur(10px);
    z-index: 100;
}

.ad-bottom {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    backdrop-filter: blur(10px);
    margin-top: 40px;
}

/* 广告样式 */
.adsbygoogle {
    display: block;
    margin: 0 auto;
}

/* 语言切换样式 */
.language-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 5px;
    z-index: 1000;
}

.lang-btn {
    padding: 8px 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.3);
    border-color: white;
    font-weight: 600;
}

/* 打印样式 */
@media print {
    body * {
        visibility: hidden;
    }
    
    .print-only,
    .print-only * {
        visibility: visible;
    }
    
    .print-only {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white;
        color: black;
    }
    
    .print-month {
        page-break-inside: avoid;
        margin-bottom: 20px;
    }
    
    .page-break {
        page-break-before: always;
        height: 0;
        margin: 0;
        padding: 0;
    }
    
    .print-month-title {
        text-align: center;
        font-size: 24px;
        margin: 20px 0;
        color: black;
        font-weight: bold;
    }
    
    .print-calendar-grid {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: 1px;
        border: 2px solid #333;
        background: #333;
    }
    
    .print-day-header {
        background: #f0f0f0;
        color: black;
        padding: 10px 5px;
        text-align: center;
        font-weight: bold;
        border: 1px solid #ccc;
    }
    
    .print-day-cell {
        background: white;
        color: black;
        padding: 8px 4px;
        min-height: 60px;
        border: 1px solid #ccc;
        position: relative;
    }
    
    .print-day-cell.other-month {
        background: #f9f9f9;
        color: #999;
    }
    
    .print-day-number {
        font-weight: bold;
        margin-bottom: 5px;
        font-size: 14px;
    }
    
    .print-garbage-events {
        font-size: 10px;
        line-height: 1.2;
    }
    
    .print-garbage-event {
        padding: 2px 4px;
        margin: 1px 0;
        border-radius: 2px;
        color: white;
        font-weight: bold;
        text-align: center;
        font-size: 9px;
    }
    
    .print-garbage-event.combustible {
        background: #dc3545;
    }
    
    .print-garbage-event.plastic-paper {
        background: #fd7e14;
    }
    
    .print-garbage-event.bottle-can {
        background: #20c997;
    }
    
    .print-garbage-event.non-combustible {
        background: #6f42c1;
    }
    
    .print-garbage-event.pet-bottle {
        background: #17a2b8;
    }
}

/* 打印专用内容 - 非打印时隐藏 */
.print-only {
    display: none;
}

/* ICS模态框样式 */
.ics-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ics-modal-content {
    background: white;
    border-radius: 15px;
    max-width: 90%;
    max-height: 80%;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.ics-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.ics-modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.2rem;
}

.ics-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.ics-modal-close:hover {
    background: #e9ecef;
    color: #333;
}

.ics-modal-body {
    padding: 20px;
}

.ics-content-textarea {
    width: 100%;
    min-height: 200px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.4;
    resize: vertical;
    margin-bottom: 15px;
}

.copy-btn {
    width: 100%;
    margin-top: 10px;
}

/* 移动端模态框优化 */
@media (max-width: 768px) {
    .ics-modal {
        padding: 10px;
    }
    
    .ics-modal-content {
        max-width: 95%;
        max-height: 90%;
    }
    
    .ics-modal-header {
        padding: 15px;
    }
    
    .ics-modal-header h3 {
        font-size: 1.1rem;
    }
    
    .ics-modal-body {
        padding: 15px;
    }
    
    .ics-content-textarea {
        min-height: 150px;
        font-size: 11px;
        padding: 10px;
    }
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 主要内容区域 */
main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-right: 200px; /* 为侧边广告留出空间 */
}

/* 设置区域 */
.settings-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.settings-section h2 {
    color: #333;
    margin-bottom: 25px;
    font-size: 1.5rem;
    font-weight: 600;
}

/* 表单样式 */
.form-group {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.weekday-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.weekday-selector label {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 400;
    margin: 0;
}

.weekday-selector label:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.weekday-selector input[type="checkbox"]:checked + span {
    color: #667eea;
}

.weekday-selector input[type="checkbox"] {
    margin: 0;
}

.week-selector {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.week-selector label {
    margin: 0;
    font-weight: 500;
    min-width: 80px;
}

.week-checkboxes {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.week-checkboxes label {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 5px 6px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 400;
    font-size: 11px;
    margin: 0;
    min-width: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

.week-checkboxes label:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.week-checkboxes input[type="checkbox"] {
    margin: 0;
}

/* 按钮样式 */
.btn-primary, .btn-secondary, .btn-success {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.6);
}

/* 日历区域 */
.calendar-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.calendar-section h2 {
    color: #333;
    margin-bottom: 25px;
    font-size: 1.5rem;
    font-weight: 600;
}

.calendar-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

#currentMonth {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    min-width: 150px;
    text-align: center;
}

/* 日历网格 */
.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 25px;
}

.calendar-header {
    background: #667eea;
    color: white;
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
}

.calendar-day {
    background: white;
    padding: 15px 10px;
    min-height: 80px;
    position: relative;
    transition: all 0.3s ease;
}

.calendar-day:hover {
    background: #f8f9ff;
}

.calendar-day.other-month {
    background: #f8f9fa;
    color: #adb5bd;
}

.calendar-day.today {
    background: #e3f2fd;
    border: 2px solid #2196f3;
}

.day-number {
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.garbage-events {
    font-size: 11px;
    line-height: 1.3;
}

.garbage-event {
    padding: 2px 4px;
    margin: 1px 0;
    border-radius: 3px;
    color: white;
    font-weight: 500;
    text-align: center;
}

.garbage-event.combustible {
    background: #dc3545;
}

.garbage-event.plastic-paper {
    background: #fd7e14;
}

.garbage-event.bottle-can {
    background: #20c997;
}

.garbage-event.non-combustible {
    background: #6f42c1;
}

.garbage-event.pet-bottle {
    background: #17a2b8;
}

/* 日历操作按钮 */
.calendar-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    main {
        margin-right: 0;
        width: 100%;
    }
    
    .ad-sidebar {
        position: static;
        transform: none;
        width: 100%;
        margin: 20px 0;
    }
    
    header h1 {
        font-size: 1.8rem;
        word-wrap: break-word;
    }
    
    header p {
        font-size: 1rem;
        word-wrap: break-word;
    }
    
    .settings-section,
    .calendar-section {
        padding: 20px 15px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .form-group {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .weekday-selector {
        flex-direction: column;
        gap: 8px;
    }
    
    .weekday-selector label {
        justify-content: center;
        padding: 6px 8px;
        font-size: 14px;
    }
    
    .week-selector {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .week-checkboxes {
        width: 100%;
        justify-content: flex-start;
        gap: 4px;
        overflow-x: auto;
        padding-bottom: 5px;
    }
    
    .week-checkboxes label {
        font-size: 10px;
        padding: 3px 4px;
        min-width: 40px;
        flex-shrink: 0;
    }
    
    .calendar-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .calendar-actions {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .calendar-day {
        min-height: 60px;
        padding: 10px 5px;
    }
    
    .garbage-events {
        font-size: 10px;
    }
    
    .language-switcher {
        position: fixed;
        top: 10px;
        right: 10px;
        gap: 3px;
    }
    
    .lang-btn {
        padding: 6px 8px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 5px;
    }
    
    .settings-section,
    .calendar-section {
        padding: 15px 10px;
    }
    
    .form-group {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    header h1 {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }
    
    header p {
        font-size: 0.9rem;
    }
    
    .weekday-selector label {
        padding: 5px 6px;
        font-size: 13px;
    }
    
    .week-checkboxes label {
        font-size: 9px;
        padding: 2px 3px;
        min-width: 35px;
    }
    
    .calendar-day {
        min-height: 45px;
        padding: 6px 2px;
    }
    
    .day-number {
        font-size: 11px;
    }
    
    .garbage-events {
        font-size: 8px;
    }
    
    .language-switcher {
        top: 5px;
        right: 5px;
    }
    
    .lang-btn {
        padding: 4px 6px;
        font-size: 11px;
    }
    
    .btn-primary, .btn-secondary, .btn-success {
        padding: 10px 20px;
        font-size: 14px;
    }
}

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

.calendar-section {
    animation: fadeIn 0.5s ease-out;
}

/* 加载状态 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* 成功提示 */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid #c3e6cb;
    animation: fadeIn 0.3s ease-out;
}

/* 错误提示 */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid #f5c6cb;
    animation: fadeIn 0.3s ease-out;
}
