/**
 * Weather Dashboard Styles
 * Improved and optimized styling
 */

/* ============================================
   RESET & BASE STYLES
   ============================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    transition: background-color 0.3s ease, color 0.3s ease;
    line-height: 1.6;
}

/* ============================================
   CONTAINER & LAYOUT
   ============================================ */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    padding-top: 80px;
}

/* ============================================
   CONTROLS
   ============================================ */

.controls {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: calc(100% - 20px);
    max-width: 800px;
}

.button-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.controls button,
.timeframe-btn {
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    background-color: #007bff;
    color: white;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-sizing: border-box;
    white-space: nowrap;
}

.controls button:hover,
.timeframe-btn:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.controls button:active,
.timeframe-btn:active {
    transform: translateY(0);
}

.controls button.active,
.timeframe-btn.active {
    background-color: #28a745;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.mobile-controls {
    display: none;
    width: 100%;
    max-width: 200px;
    padding: 8px;
    font-size: 14px;
    border-radius: 6px;
    border: 1px solid #007bff;
    background-color: #fff;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-controls:hover {
    border-color: #0056b3;
}

/* ============================================
   CARDS
   ============================================ */

.cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.card {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
    width: 100%;
    max-width: 1200px;
    box-sizing: border-box;
    transition: all 0.3s ease;
    position: relative;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

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

.card-header h2 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
    color: #333;
}

.summary {
    text-align: right;
}

.summary p {
    margin: 5px 0;
    font-size: 0.85em;
    line-height: 1.4;
}

/* ============================================
   LABELS & COLORS
   ============================================ */

.label-max::before {
    content: "Μέγιστη: ";
    color: #dc3545;
    font-weight: 600;
}

.label-avg::before {
    content: "Μέσος Όρος: ";
    color: #28a745;
    font-weight: 600;
}

.label-min::before {
    content: "Ελάχιστη: ";
    color: #007bff;
    font-weight: 600;
}

.label-total::before {
    content: "Συνολική: ";
    color: #6f42c1;
    font-weight: 600;
}

.label-rainfall-max::before {
    content: "Μέγιστη Βροχόπτωση: ";
    color: #ff4500;
    font-weight: 600;
}

.label-rainfall-total::before {
    content: "Συνολική Βροχόπτωση: ";
    color: #800080;
    font-weight: 600;
}

.label-rainfall-dry-period::before {
    content: "Περίοδος Ξηρασίας: ";
    color: #4682b4;
    font-weight: 600;
}

.label-gust::before {
    content: "Ριπή: ";
    color: #4682B4;
    font-weight: 600;
}

.label-sunshine::before {
    content: "Ηλιοφάνεια: ";
    color: #ffc107;
    font-weight: 600;
}

.summary span {
    font-weight: 500;
}

/* ============================================
   CANVAS
   ============================================ */

canvas {
    max-height: 280px !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* ============================================
   LOADING & ERROR STATES
   ============================================ */

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    z-index: 10;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    padding: 12px;
    margin-bottom: 15px;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    font-size: 0.9em;
}

/* ============================================
   CUSTOM TOOLTIP STYLES - COLORFUL WITH ICONS
   ============================================ */

.custom-tooltip {
    position: absolute;
    pointer-events: none;
    z-index: 1000;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 13px;
    border: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.custom-tooltip .tooltip-title {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #FFFFFF;
    padding: 10px 16px;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.custom-tooltip .tooltip-title::before {
    content: '📅';
    font-size: 16px;
}

.custom-tooltip .tooltip-body {
    background: rgba(255, 255, 255, 0.98);
    color: #2c3e50;
    padding: 12px 16px;
}

.custom-tooltip .tooltip-body div {
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}


/* Value coloring */
.custom-tooltip .tooltip-body div {
    color: #2c3e50;
}

/* Dark mode styles */
body.dark-mode .custom-tooltip {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

body.dark-mode .custom-tooltip .tooltip-title {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

body.dark-mode .custom-tooltip .tooltip-body {
    background: rgba(45, 45, 45, 0.98);
    color: #e9ecef;
}

body.dark-mode .custom-tooltip .tooltip-body div {
    color: #e9ecef;
}

/* ============================================
   DARK MODE
   ============================================ */

body.dark-mode {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

body.dark-mode .card {
    background-color: #2d2d2d;
}

body.dark-mode .card-header h2 {
    color: #e0e0e0;
}

body.dark-mode .controls {
    background-color: rgba(30, 30, 30, 0.95);
}

body.dark-mode .controls button,
body.dark-mode .timeframe-btn {
    background-color: #4a90e2;
}

body.dark-mode .controls button:hover,
body.dark-mode .timeframe-btn:hover {
    background-color: #357abd;
}

body.dark-mode .controls button.active,
body.dark-mode .timeframe-btn.active {
    background-color: #50c878;
}

body.dark-mode .mobile-controls {
    background-color: #2d2d2d;
    color: #e0e0e0;
    border: 1px solid #4a90e2;
}

body.dark-mode .label-max::before {
    color: #ff6b6b;
}

body.dark-mode .label-avg::before {
    color: #51cf66;
}

body.dark-mode .label-min::before {
    color: #74c0fc;
}

body.dark-mode .label-total::before {
    color: #cc5de8;
}

body.dark-mode .label-rainfall-max::before {
    color: #ff8787;
}

body.dark-mode .label-rainfall-total::before {
    color: #da77f2;
}

body.dark-mode .label-rainfall-dry-period::before {
    color: #91a7ff;
}

body.dark-mode .label-gust::before {
    color: #74c0fc;
}

body.dark-mode .label-sunshine::before {
    color: #ffd43b;
}

body.dark-mode .custom-tooltip {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border: 1px solid #444;
}

body.dark-mode .custom-tooltip .tooltip-title {
    background-color: #1a1a1a;
    color: #FFFFFF;
}

body.dark-mode .custom-tooltip .tooltip-body {
    background-color: #2d2d2d;
    color: #e0e0e0;
}

body.dark-mode .loading-overlay {
    background-color: rgba(30, 30, 30, 0.9);
}

body.dark-mode .error-message {
    background-color: #5c2828;
    color: #ffb3b3;
    border-color: #7a3535;
}

/* ============================================
   RESPONSIVE - TABLET
   ============================================ */

@media (max-width: 1024px) {
    .container {
        padding: 15px;
        padding-top: 70px;
    }

    .card {
        max-width: 90%;
        padding: 15px;
    }

    .controls button,
    .timeframe-btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .card-header h2 {
        font-size: 1.15em;
    }

    .summary p {
        font-size: 0.8em;
    }

    canvas {
        max-height: 250px !important;
    }
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */

@media (max-width: 768px) {
    .container {
        padding: 10px;
        padding-top: 65px;
    }

    .card {
        max-width: 100%;
        padding: 12px;
        border-radius: 8px;
    }

    .controls {
        padding: 6px;
        width: calc(100% - 16px);
    }

    .button-controls {
        display: none;
    }

    .mobile-controls {
        display: block;
        margin: 0 auto;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .summary {
        text-align: left;
        width: 100%;
    }

    .card-header h2 {
        font-size: 1.1em;
    }

    .summary p {
        font-size: 0.75em;
    }

    canvas {
        max-height: 200px !important;
        min-width: 100% !important;
    }

    .chartjs-legend {
        display: none !important;
    }
}

/* ============================================
   MOBILE TOOLTIP OPTIMIZATION
   ============================================ */

@media (max-width: 768px) {
    /* Smaller tooltips for mobile */
    .custom-tooltip {
        font-size: 11px;
        max-width: 220px;
    }
    
    .custom-tooltip .tooltip-title {
        padding: 8px 12px;
        font-size: 11px;
    }
    
    .custom-tooltip .tooltip-title::before {
        font-size: 14px;
    }
    
    .custom-tooltip .tooltip-body {
        padding: 8px 12px;
    }
    
    .custom-tooltip .tooltip-body div {
        margin: 6px 0;
        font-size: 12px;
    }
    
    .custom-tooltip .tooltip-body div::before {
        font-size: 14px;
    }
    
    /* Prevent tooltip from going off-screen */
    .custom-tooltip {
        transform: translateX(-50%);
        left: 50% !important;
    }
    
    /* Touch-friendly chart interactions */
    canvas {
        touch-action: pan-y;
    }
    
    /* Larger touch targets for legend */
    .chartjs-legend {
        padding: 12px 0;
    }
    
    .chartjs-legend li {
        padding: 8px;
        margin: 4px 0;
    }
}

/* Extra small devices (phones in portrait) */
@media (max-width: 480px) {
    .custom-tooltip {
        font-size: 10px;
        max-width: 180px;
    }
    
    .custom-tooltip .tooltip-title {
        padding: 6px 10px;
        font-size: 10px;
    }
    
    .custom-tooltip .tooltip-body {
        padding: 6px 10px;
    }
    
    .custom-tooltip .tooltip-body div {
        font-size: 11px;
        margin: 4px 0;
    }
}
/* ============================================
   ANIMATIONS
   ============================================ */

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

.card {
    animation: fadeIn 0.4s ease-out;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .controls {
        display: none;
    }

    .container {
        padding-top: 20px;
    }

    .card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
/* ============================================
   CLEAN MODERN DESIGN - NO GLASSMORPHISM
   ============================================ */

/* Clean subtle background */
body {
    background: #f5f7fa;
}

body.dark-mode {
    background: #1a1d23;
}

/* Clean white cards */
.card {
    background: #ffffff;
    border: 1px solid #e0e4e8;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.card-header h2 {
    color: #2c3e50;
}

/* Summary boxes - clean with colored accents */
.summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.summary p {
    background: #f8f9fa;
    padding: 14px 12px;
    border-radius: 10px;
    border-left: 4px solid #6c757d;
    transition: all 0.3s ease;
}

.summary p:nth-child(1) {
    border-left-color: #dc3545;
}

.summary p:nth-child(2) {
    border-left-color: #28a745;
}

.summary p:nth-child(3) {
    border-left-color: #007bff;
}

.summary p:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: #ffffff;
}

/* Label colors */
.label-max::before {
    color: #dc3545 !important;
    font-weight: 600;
}

.label-avg::before {
    color: #28a745 !important;
    font-weight: 600;
}

.label-min::before {
    color: #007bff !important;
    font-weight: 600;
}

.summary span {
    font-size: 16px;
    font-weight: 700;
    color: #2c3e50;
    display: inline;
}

/* Canvas background */
canvas {
    background: #fafbfc !important;
    border-radius: 8px;
    padding: 10px;
}

/* Clean controls */
.controls {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border: 1px solid #e0e4e8;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.controls button,
.timeframe-btn {
    background: #007bff;
    font-weight: 600;
}

.controls button:hover,
.timeframe-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.controls button.active,
.timeframe-btn.active {
    background: #28a745;
}

/* Dark mode */
body.dark-mode .card {
    background: #2d3139;
    border-color: #3a3f4b;
}

body.dark-mode .card-header h2 {
    color: #e9ecef;
}

body.dark-mode .summary p {
    background: #1e2127;
    border-left-width: 4px;
}

body.dark-mode .summary p:hover {
    background: #252930;
}

body.dark-mode .summary span {
    color: #e9ecef;
}

body.dark-mode canvas {
    background: #1e2127 !important;
}

body.dark-mode .controls {
    background: rgba(30, 33, 39, 0.98);
    border-color: #3a3f4b;
}

body.dark-mode .label-max::before {
    color: #ff6b6b !important;
}

body.dark-mode .label-avg::before {
    color: #51cf66 !important;
}

body.dark-mode .label-min::before {
    color: #74c0fc !important;
}

/* Mobile */
@media (max-width: 768px) {
    .summary {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .summary p {
        padding: 12px;
    }

    .summary span {
        font-size: 15px;
    }
}


/* ==============================================
   WIND ROSE STYLES - UPDATED VERSION
   ============================================== */

/* Wind Rose Container */
.wind-rose-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1;
    margin: 0 auto;
}

.wind-rose-container canvas {
    max-width: 100% !important;
    max-height: 100% !important;
}

/* Center Circle */
.wind-rose-center {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 50%;
    width: 65px;
    height: 65px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
    pointer-events: none;
}

.wind-rose-center .avg-speed-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2980b9;
    line-height: 1.1;
}

.wind-rose-center .avg-speed-label {
    font-size: 0.65rem;
    color: #666;
    text-transform: uppercase;
}

/* Legend Container */
.wind-rose-legend {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    text-align: center;
}

.wind-rose-legend .legend-title {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 10px;
    font-weight: 500;
}

/* ==============================================
   DYNAMIC SPEED BAR
   ============================================== */

.speed-bar-container {
    margin: 10px auto 15px;
    max-width: 100%;
    padding: 0 10px;
}

/* Labels πάνω (ταχύτητες) */
.speed-bar-labels-top {
    display: flex;
    width: 100%;
    margin-bottom: 3px;
}

.speed-label-top {
    text-align: center;
    overflow: hidden;
}

.speed-label-top span {
    font-size: 0.8rem;
    font-weight: 600;
    color: #444;
    white-space: nowrap;
}

/* Η μπάρα */
.speed-bar {
    display: flex;
    width: 100%;
    height: 20px;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.speed-bar-segment {
    height: 100%;
    min-width: 2px;
    transition: width 0.3s ease;
}

/* Labels κάτω (ποσοστά) */
.speed-bar-labels-bottom {
    display: flex;
    width: 100%;
    margin-top: 3px;
}

.speed-label-bottom {
    text-align: center;
    overflow: hidden;
}

.speed-label-bottom span {
    font-size: 0.8rem;
    color: #333;
    white-space: nowrap;
}

/* No data message */
.no-data {
    text-align: center;
    color: #999;
    font-size: 0.8rem;
    padding: 10px;
}

/* ==============================================
   WIND STATS ROW
   ============================================== */

.wind-stats {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #eee;
    margin-top: 10px;
}

.wind-stat {
    text-align: center;
    flex: 1;
    padding: 0 5px;
}

.wind-stat-value {
    display: block;
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    line-height: 1.2;
}

.wind-stat-label {
    display: block;
    font-size: 0.65rem;
    color: #888;
    text-transform: uppercase;
    margin-top: 2px;
}

/* ==============================================
   DARK MODE
   ============================================== */

.dark-mode .wind-rose-center {
    background: rgba(45, 45, 45, 0.8);
}

.dark-mode .wind-rose-center .avg-speed-value {
    color: #5dade2;
}

.dark-mode .wind-rose-center .avg-speed-label {
    color: #aaa;
}

.dark-mode .wind-rose-legend {
    border-top-color: #444;
}

.dark-mode .wind-rose-legend .legend-title {
    color: #aaa;
}

.dark-mode .speed-label-top span {
    color: #ddd;
}

.dark-mode .speed-label-bottom span {
    color: #999;
}

.dark-mode .speed-bar {
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.dark-mode .wind-stats {
    border-top-color: #444;
}

.dark-mode .wind-stat-value {
    color: #fff;
}

.dark-mode .wind-stat-label {
    color: #999;
}

/* ==============================================
   RESPONSIVE
   ============================================== */

@media (max-width: 768px) {
    .wind-rose-container {
        max-width: 260px;
        height: 260px;
        margin: 5px auto;
    }
    
    .wind-rose-center {
        width: 50px;
        height: 50px;
    }
    
    .wind-rose-center .avg-speed-value {
        font-size: 0.95rem;
    }
    
    .wind-rose-center .avg-speed-label {
        font-size: 0.55rem;
    }
    
    .wind-rose-legend .legend-title {
        font-size: 0.75rem;
    }
    
    .speed-bar-container {
        padding: 0 5px;
    }
    
    .speed-bar {
        height: 16px;
    }
    
    .speed-label-top span {
        font-size: 0.6rem;
    }
    
    .speed-label-bottom span {
        font-size: 0.55rem;
    }
    
    .wind-stats {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .wind-stat {
        flex: 0 0 30%;
        padding: 5px;
    }
    
    .wind-stat-value {
        font-size: 0.95rem;
    }
    
    .wind-stat-label {
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .wind-rose-container {
        max-width: 200px;
        height: 200px;
    }
    
    .wind-rose-center {
        width: 42px;
        height: 42px;
    }
    
    .wind-rose-center .avg-speed-value {
        font-size: 0.8rem;
    }
    
    .wind-rose-center .avg-speed-label {
        font-size: 0.5rem;
    }
    
    .speed-bar {
        height: 14px;
    }
    
    .speed-label-top span {
        font-size: 0.55rem;
    }
    
    .speed-label-bottom span {
        font-size: 0.5rem;
    }
    
    .wind-stat {
        flex: 0 0 30%;
    }
    
    .wind-stat-value {
        font-size: 0.85rem;
    }
    
    .wind-stat-label {
        font-size: 0.55rem;
    }
}

.speed-bar-segment {
    position: relative;
    cursor: pointer;
}

/* Historical comparison - smaller font */
.historical {
    font-size: 0.72em;
    color: #666;
    display: block;
    margin-top: 2px;
}
.historical .up { color: #e74c3c; font-weight: bold; }
.historical .down { color: #3498db; font-weight: bold; }
.dark-mode .historical { color: #aaa; }

/* Dark mode - Chart.js axes */
body.dark-mode canvas {
    filter: none;
}
