:root {
    --accent-color: var(--tg-theme-button-color, #3B82F6);
}

body {
    background-color: var(--tg-theme-bg-color, #ffffff);
    color: var(--tg-theme-text-color, #000000);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 480px;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.header {
    text-align: center;
    margin-bottom: 10px;
}

.header h1 {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 5px 0;
    color: var(--tg-theme-text-color, #000000);
}

.header p {
    font-size: 14px;
    color: var(--tg-theme-hint-color, #888888);
    margin: 0;
}

/* Tabs Styles */
.tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    padding: 6px;
    border-radius: 12px;
}
.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px;
    color: var(--tg-theme-hint-color, #888888);
    font-size: 15px;
    border-radius: 8px;
    transition: all 0.2s;
    font-weight: 500;
}
.tab-btn.active {
    background: var(--tg-theme-bg-color, #ffffff);
    color: var(--tg-theme-text-color, #000000);
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}
.tab-content.active {
    display: block;
}

/* Zone Grid */
.zone-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.zone-btn {
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    border: 2px solid transparent;
    border-radius: 16px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--tg-theme-text-color, #000000);
}

.zone-btn .icon {
    font-size: 24px;
    background: var(--tg-theme-bg-color, #ffffff);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.zone-btn .label {
    font-size: 15px;
    font-weight: 600;
}

.zone-btn.selected {
    border-color: var(--accent-color);
    background: rgba(59, 130, 246, 0.05);
}

.zone-btn.selected .icon {
    background: var(--accent-color);
    color: white;
}

/* Intensity Section */
.intensity-section {
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    border-radius: 16px;
    padding: 20px;
    margin-top: 20px;
    text-align: center;
    transition: opacity 0.3s ease;
}

.intensity-section.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.intensity-section h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--tg-theme-text-color, #000000);
}

.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.slider-emoji {
    font-size: 20px;
}

.slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--tg-theme-hint-color, #d1d5db);
    border-radius: 3px;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.intensity-display {
    margin-top: 10px;
}

.status-badge {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 600;
    color: white;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.status-1 { background: #2ed573; }
.status-2 { background: #eccc68; color: #333; }
.status-3 { background: #ffa502; }
.status-4 { background: #ff4757; }
.status-5 { background: #3742fa; }

/* Calendar Styles */
.calendar-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-bottom: 30px;
}
.calendar-day {
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    border-radius: 16px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--tg-theme-hint-color, #e5e7eb);
    padding-bottom: 10px;
    opacity: 0.5;
}
.day-date {
    font-size: 16px;
    font-weight: 600;
    color: var(--tg-theme-text-color, #000000);
}
.day-weather {
    display: flex;
    gap: 8px;
    font-size: 13px;
    flex-wrap: wrap;
}
.weather-badge {
    background: var(--tg-theme-bg-color, #ffffff);
    padding: 4px 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--tg-theme-hint-color, #e5e7eb);
    color: var(--tg-theme-text-color, #000000);
}
.weather-badge.ok { 
    background: rgba(46, 213, 115, 0.1); 
    color: #2ed573; 
    border: none;
}
.weather-badge.unknown { 
    opacity: 0.6;
}
.symptom-card {
    background: var(--tg-theme-bg-color, #ffffff);
    padding: 10px 12px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.symptom-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.symptom-zone {
    font-size: 12px;
    color: var(--tg-theme-hint-color, #888888);
}
.symptom-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--tg-theme-text-color, #000000);
}
.symptom-intensity {
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}
.intensity-low { background: #2ed573; }
.intensity-med { background: #ffa502; }
.intensity-high { background: #ff4757; }

.symptom-card.empty { 
    justify-content: center;
    background: transparent;
    box-shadow: none;
    color: var(--tg-theme-hint-color, #888888);
    font-size: 14px;
}

.day-symptoms { display: flex; flex-direction: column; gap: 8px; margin-top: 5px; }

.no-data {
    text-align: center;
    color: var(--tg-theme-hint-color, #888888);
    padding: 20px;
    font-size: 14px;
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    border-radius: 12px;
}

.primary-btn {
    background: var(--tg-theme-button-color, #3B82F6);
    color: var(--tg-theme-button-text-color, #ffffff);
    border: none;
    padding: 15px;
    width: 100%;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
}

/* Charts Styles */
.charts-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 30px;
}

.insight-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.05));
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.insight-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 6px;
}

.insight-card p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--tg-theme-text-color, #000000);
}

.chart-card {
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid rgba(255,255,255,0.1);
}

.chart-header {
    margin-bottom: 15px;
}

.chart-header h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--tg-theme-text-color, #000000);
}

.chart-subtitle {
    font-size: 12px;
    color: var(--tg-theme-hint-color, #888888);
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    height: 220px;
}

.legend-box {
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    border-radius: 14px;
    padding: 15px;
    font-size: 13px;
    color: var(--tg-theme-text-color, #000000);
    line-height: 1.5;
    border-left: 4px solid var(--accent-color);
}

.legend-box p {
    margin: 0;
}

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

/* Symptom Selection Grid */
.symptom-section {
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    border-radius: 16px;
    padding: 20px;
    margin-top: 15px;
    transition: opacity 0.3s ease;
}

.symptom-section.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.symptom-section h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--tg-theme-text-color, #000000);
}

.symptom-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.symptom-btn {
    background: var(--tg-theme-bg-color, #ffffff);
    color: var(--tg-theme-text-color, #000000);
    border: 2px solid transparent;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.symptom-btn:hover {
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
}

.symptom-btn.selected {
    border-color: var(--accent-color);
    background: rgba(59, 130, 246, 0.05);
    font-weight: 600;
}

/* Sensors Modal Window */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--tg-theme-bg-color, #ffffff);
    color: var(--tg-theme-text-color, #000000);
    width: 85%;
    max-width: 380px;
    padding: 24px;
    border-radius: 24px;
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
    text-align: center;
    animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleUp {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-content h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 700;
}

.modal-content p {
    font-size: 13px;
    color: var(--tg-theme-hint-color, #888888);
    margin: 0 0 20px 0;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 20px;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: var(--accent-color);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.sensor-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    padding: 16px;
    border-radius: 16px;
}

.stat-row {
    font-size: 14px;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
}

.stat-row span {
    font-weight: 700;
    color: var(--accent-color);
}
