/**
 * ═══════════════════════════════════════════════════════════════════════════
 * RADIM DASHBOARD WIDGETS - CSS
 * Weather, Tasks, Health, Daily Summary
 * ═══════════════════════════════════════════════════════════════════════════
 */

:root {
    /* Widget-specific vars (base colors inherited from kolibri-dashboard-v2.css) */
    --widget-bg: rgba(91, 168, 160, 0.06);
    --widget-border: rgba(91, 168, 160, 0.15);
    --widget-shadow: 0 4px 20px rgba(91, 168, 160, 0.1);
    --widget-radius: 16px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BASE WIDGET
   ═══════════════════════════════════════════════════════════════════════════ */

.widget {
    background: var(--widget-bg);
    border: 1px solid var(--widget-border);
    border-radius: var(--widget-radius);
    box-shadow: var(--widget-shadow);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.widget-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.2), rgba(18, 140, 126, 0.2));
    border-bottom: 1px solid var(--widget-border);
}

.widget-icon {
    font-size: 24px;
}

.widget-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.widget-add-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.widget-add-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.widget-content {
    padding: 20px;
}

.widget.loading .widget-content {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(91, 168, 160, 0.08);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   DAILY SUMMARY
   ═══════════════════════════════════════════════════════════════════════════ */

.daily-summary {
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.15), rgba(18, 140, 126, 0.15));
    border-radius: var(--widget-radius);
    padding: 24px;
    margin-bottom: 24px;
}

.summary-greeting {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
}

.greeting-emoji {
    font-size: 48px;
    animation: gentlePulse 3s ease-in-out infinite;
}

@keyframes gentlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.greeting-text h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-date {
    margin: 4px 0 0;
    font-size: 16px;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.summary-nameday {
    margin: 8px 0 0;
    font-size: 14px;
    color: var(--accent-primary);
}

.summary-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.stat-item {
    padding: 8px 16px;
    background: rgba(91, 168, 160, 0.08);
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   WEATHER WIDGET
   ═══════════════════════════════════════════════════════════════════════════ */

.weather-widget .weather-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 16px;
}

.weather-temp {
    font-size: 48px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.weather-desc {
    font-size: 16px;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.weather-details {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.weather-forecast {
    display: flex;
    justify-content: space-around;
    padding-top: 16px;
    border-top: 1px solid var(--widget-border);
}

.forecast-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.forecast-icon {
    font-size: 24px;
}

.forecast-temps {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TASKS WIDGET
   ═══════════════════════════════════════════════════════════════════════════ */

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tasks-empty {
    text-align: center;
    padding: 32px;
    color: var(--text-secondary);
    font-size: 16px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(91, 168, 160, 0.04);
    border-radius: 12px;
    border-left: 4px solid var(--accent-primary);
    transition: all 0.2s ease;
}

.task-item:hover {
    background: rgba(91, 168, 160, 0.08);
}

.task-item.done {
    opacity: 0.6;
}

.task-item.done .task-text {
    text-decoration: line-through;
}

.task-item.priority-high {
    border-left-color: #ef4444;
}

.task-item.priority-medium {
    border-left-color: #f59e0b;
}

.task-item.priority-low {
    border-left-color: #22c55e;
}

.task-check {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.2s;
}

.task-check:hover {
    transform: scale(1.2);
}

.task-icon {
    font-size: 24px;
}

.task-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.task-text {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 500;
}

.task-time {
    font-size: 13px;
    color: var(--text-secondary);
}

.task-delete {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: 16px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
}

.task-item:hover .task-delete {
    opacity: 1;
}

.task-delete:hover {
    transform: scale(1.2);
}

/* Done section */
.tasks-done-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--widget-border);
}

.tasks-done-header {
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    margin: -8px;
    transition: color 0.2s;
}

.tasks-done-header:hover {
    color: var(--accent-primary);
}

.tasks-done-list {
    display: none;
    margin-top: 12px;
}

.tasks-done-section.expanded .tasks-done-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HEALTH WIDGET
   ═══════════════════════════════════════════════════════════════════════════ */

.health-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.health-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: rgba(91, 168, 160, 0.04);
    border-radius: 12px;
    position: relative;
}

.health-icon {
    font-size: 32px;
}

.health-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.health-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

.health-mood-picker {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.health-mood-picker button {
    width: 36px;
    height: 36px;
    border: 2px solid transparent;
    border-radius: 50%;
    background: rgba(91, 168, 160, 0.08);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.health-mood-picker button:hover {
    background: rgba(91, 168, 160, 0.15);
}

.health-mood-picker button.active {
    border-color: var(--accent-primary);
    background: rgba(37, 211, 102, 0.2);
}

.health-add {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.health-add:hover {
    transform: scale(1.1);
}

.health-medications {
    background: rgba(91, 168, 160, 0.04);
    border-radius: 12px;
    padding: 16px;
}

.health-med-title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.health-med-items {
    display: flex;
    gap: 16px;
}

.health-med-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
}

.health-med-item input {
    width: 20px;
    height: 20px;
    accent-color: var(--accent-primary);
}

.health-med-item input:checked + span {
    color: var(--accent-primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

.radim-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

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

.radim-modal {
    background: linear-gradient(135deg, #ffffff, #f0f5f5);
    border: 1px solid var(--widget-border);
    border-radius: 20px;
    width: 90%;
    max-width: 420px;
    overflow: hidden;
    animation: modalSlideUp 0.3s ease;
}

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

.radim-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.2), rgba(18, 140, 126, 0.2));
    border-bottom: 1px solid var(--widget-border);
}

.radim-modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: var(--text-primary);
}

.radim-modal-header button {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(91, 168, 160, 0.08);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.radim-modal-header button:hover {
    background: rgba(91, 168, 160, 0.15);
}

.radim-modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="time"] {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--widget-border);
    border-radius: 12px;
    background: rgba(91, 168, 160, 0.04);
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--accent-primary);
}

.priority-buttons {
    display: flex;
    gap: 8px;
}

.priority-btn {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--widget-border);
    border-radius: 10px;
    background: rgba(91, 168, 160, 0.04);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.priority-btn:hover {
    background: rgba(91, 168, 160, 0.08);
}

.priority-btn.active {
    background: rgba(37, 211, 102, 0.2);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.radim-modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--widget-border);
}

.radim-modal-footer button {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary {
    background: rgba(91, 168, 160, 0.08);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(91, 168, 160, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .daily-summary {
        padding: 20px;
    }
    
    .greeting-emoji {
        font-size: 36px;
    }
    
    .greeting-text h2 {
        font-size: 22px;
    }
    
    .health-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .health-item {
        padding: 12px;
    }
    
    .health-icon {
        font-size: 24px;
    }
    
    .health-value {
        font-size: 18px;
    }
    
    .weather-temp {
        font-size: 36px;
    }
}

@media (max-width: 480px) {
    .summary-greeting {
        flex-direction: column;
        text-align: center;
    }
    
    .summary-stats {
        justify-content: center;
    }
    
    .weather-details {
        flex-direction: column;
        gap: 8px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   DARK MODE ENHANCEMENTS
   ═══════════════════════════════════════════════════════════════════════════ */

@media (prefers-color-scheme: light) {
    :root {
        --widget-bg: rgba(255, 255, 255, 0.9);
        --text-primary: #ffffff;
        --text-secondary: rgba(26, 26, 46, 0.7);
    }
}
