/* css/modals.css */

/* --- Modal Base --- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border-bottom: 2px solid #f0f0f0;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    color: #667eea;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}
.modal-close:hover { background: #f0f0f0; color: #333; }

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}


/* --- Data Management Modal --- */
.data-info {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
}
.data-info p { margin: 0.8rem 0; line-height: 1.6; color: #555; }
.data-info strong { color: #333; }

.data-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
}
.action-btn:hover { transform: translateY(-2px); }
.export-btn:hover { border-color: #4CAF50; box-shadow: 0 4px 15px rgba(76, 175, 80, 0.2); }
.import-btn:hover { border-color: #2196F3; box-shadow: 0 4px 15px rgba(33, 150, 243, 0.2); }

.btn-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.btn-text { font-size: 1.2rem; font-weight: bold; color: #333; margin-bottom: 0.3rem; }
.btn-desc { font-size: 0.9rem; color: #888; }


/* --- Tips Modal --- */
.tips-modal {
    max-width: 800px;
}

.tips-intro {
    background: linear-gradient(135deg, #FFF3E0 0%, #FFE0B2 100%);
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    border-left: 4px solid #FF9800;
}
.tips-intro p { margin: 0; color: #E65100; font-size: 1.1rem; font-weight: 600; line-height: 1.6; }

.tip-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 2px solid #e0e0e0;
    transition: all 0.3s;
}
.tip-section:hover { border-color: #667eea; box-shadow: 0 4px 15px rgba(102, 126, 234, 0.1); }

.tip-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.tip-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    color: white;
}
.tip-badge.round1 { background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%); }
.tip-badge.round2 { background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%); }
.tip-badge.round3 { background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%); }
.tip-badge.round4 { background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%); }
.tip-badge.round5 { background: linear-gradient(135deg, #9C27B0 0%, #7B1FA2 100%); }
.tip-badge.round6 { background: linear-gradient(135deg, #00BCD4 0%, #0097A7 100%); }
.tip-badge.round7 { background: linear-gradient(135deg, #8BC34A 0%, #689F38 100%); }

.tip-title { font-size: 1.3rem; font-weight: bold; color: #333; }
.tip-content { margin: 0.8rem 0; line-height: 1.8; color: #555; font-size: 1rem; }
.tip-content strong { color: #667eea; }
.tip-content .highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
}


/* --- Category Choice Modal --- */
.category-choices {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.choice-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    width: 100%;
}
.choice-btn:hover { border-color: #667eea; transform: translateY(-2px); box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2); }

.choice-round {
    padding: 0.4rem 0.8rem;
    border-radius: 15px;
    font-weight: bold;
    font-size: 0.8rem;
    color: white;
}
.choice-round.round1 { background: #4CAF50; }
.choice-round.round2 { background: #2196F3; }
.choice-round.round3 { background: #FF9800; }
.choice-round.round4 { background: #f44336; }
.choice-round.round5 { background: #9C27B0; }
.choice-round.round6 { background: #00BCD4; }
.choice-round.round7 { background: #8BC34A; }

.choice-category { font-size: 1rem; font-weight: bold; color: #333; }


/* --- Chart Modal --- */
.chart-modal {
    max-width: 800px;
}

.chart-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

/* Chart Tabs */
.chart-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.chart-tab {
    padding: 0.6rem 1.2rem;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    background: white;
    color: #666;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.chart-tab:hover {
    border-color: #667eea;
    color: #667eea;
}

.chart-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

/* Chart Panels */
.chart-panel {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.chart-panel.active {
    display: flex;
}

.chart-container {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1;
    position: relative;
}

.chart-container-wide {
    max-width: 700px;
    aspect-ratio: 2 / 1;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Trend Controls */
.trend-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding-bottom: 1rem;
}

.trend-presets {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.trend-preset-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    background: white;
    color: #666;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.trend-preset-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.trend-preset-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.trend-custom-range {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1.2rem;
    background: #f8f9fa;
    border-radius: 10px;
}

.trend-custom-range input[type="date"] {
    padding: 0.5rem 0.8rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
    transition: border-color 0.2s;
}

.trend-custom-range input[type="date"]:focus {
    outline: none;
    border-color: #667eea;
}

.trend-custom-range span {
    color: #888;
    font-size: 0.9rem;
}

.trend-summary {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
    margin-top: 1rem;
}

.trend-stat {
    text-align: center;
}

.trend-stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

.trend-stat-label {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.3rem;
}

/* Heatmap Styles */
.heatmap-container {
    width: 100%;
    overflow-x: auto;
    padding: 1rem 0;
}

.heatmap-wrapper {
    display: flex;
    gap: 3px;
    padding: 10px;
}

.heatmap-month {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.heatmap-month-label {
    font-size: 0.7rem;
    color: #888;
    text-align: center;
    margin-bottom: 5px;
    font-weight: 600;
}

.heatmap-weeks {
    display: flex;
    gap: 3px;
}

.heatmap-week {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.heatmap-day {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    background: #ebedf0;
    cursor: pointer;
    transition: all 0.2s;
}

.heatmap-day:hover {
    transform: scale(1.3);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.heatmap-day.level-0 { background: #ebedf0; }
.heatmap-day.level-1 { background: #9be9a8; }
.heatmap-day.level-2 { background: #40c463; }
.heatmap-day.level-3 { background: #30a14e; }
.heatmap-day.level-4 { background: #216e39; }

.heatmap-day.future { background: #f8f9fa; opacity: 0.5; }

.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.heatmap-label {
    font-size: 0.8rem;
    color: #888;
}

.heatmap-scale {
    display: flex;
    gap: 3px;
}

.heatmap-level {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.heatmap-level.level-0 { background: #ebedf0; }
.heatmap-level.level-1 { background: #9be9a8; }
.heatmap-level.level-2 { background: #40c463; }
.heatmap-level.level-3 { background: #30a14e; }
.heatmap-level.level-4 { background: #216e39; }

.heatmap-tooltip {
    position: fixed;
    background: #333;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
}

.chart-legend {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    width: 100%;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.2s;
}

.legend-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.legend-name {
    font-weight: bold;
    color: #333;
    font-size: 0.9rem;
}

.legend-progress {
    font-size: 0.8rem;
    color: #888;
}

.legend-percent {
    font-weight: bold;
    font-size: 0.9rem;
}

.legend-item.round1 .legend-percent { color: #4CAF50; }
.legend-item.round2 .legend-percent { color: #2196F3; }
.legend-item.round3 .legend-percent { color: #FF9800; }
.legend-item.round4 .legend-percent { color: #f44336; }
.legend-item.round5 .legend-percent { color: #9C27B0; }
.legend-item.round6 .legend-percent { color: #00BCD4; }
.legend-item.round7 .legend-percent { color: #8BC34A; }
