/* ===========================================
   Pluviometría Alcázar - Frontend Chart Styles
   =========================================== */

.pluv-chart-container {
    max-width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---- Header & Year Selector ---- */
.pluv-chart-header {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
}

.pluv-year-nav {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #e2e5e9;
    border-radius: 12px;
    padding: 6px 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.pluv-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    color: #0077b6;
    transition: background 0.2s, color 0.2s;
}

.pluv-nav-btn:hover {
    background: #e3f2fd;
}

.pluv-nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.pluv-nav-btn:disabled:hover {
    background: transparent;
}

.pluv-year-select {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    background: transparent;
    font-size: 1.3rem;
    font-weight: 700;
    color: #0077b6;
    text-align: center;
    cursor: pointer;
    padding: 4px 24px 4px 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%230077b6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    outline: none;
}

.pluv-year-select:focus {
    outline: none;
}

/* ---- Bar Chart ---- */
.pluv-bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 320px;
    padding: 0 4px;
    gap: 6px;
    margin-bottom: 30px;
    position: relative;
}

@media (min-width: 768px) {
    .pluv-bar-chart {
        height: 350px;
        gap: 10px;
    }
}

.pluv-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    position: relative;
    cursor: pointer;
}

.pluv-bar-wrapper {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    position: relative;
}

.pluv-bar {
    width: 70%;
    max-width: 56px;
    min-height: 4px;
    background: linear-gradient(180deg, #48cae4 0%, #0077b6 100%);
    border-radius: 8px 8px 4px 4px;
    transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s;
    position: relative;
}

.pluv-bar-col:hover .pluv-bar {
    background: linear-gradient(180deg, #90e0ef 0%, #0077b6 100%);
    filter: brightness(1.1);
}

.pluv-bar[data-value=""] {
    background: #e2e5e9;
    min-height: 4px;
}

/* Tooltip */
.pluv-tooltip {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: #1a2a3a;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.pluv-tooltip::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #1a2a3a;
}

.pluv-bar-col:hover .pluv-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(-100%) translateY(-4px);
}

/* Month labels */
.pluv-bar-label {
    font-size: 0.82rem;
    color: #8b95a3;
    font-weight: 500;
    margin-top: 12px;
    letter-spacing: 0.02em;
}

/* ---- Stats Row ---- */
.pluv-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 50px;
    padding: 24px 0;
    border-top: 1px solid #eef0f3;
    border-bottom: 1px solid #eef0f3;
}

@media (max-width: 600px) {
    .pluv-stats {
        gap: 20px;
    }
}

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

.pluv-stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0077b6;
    line-height: 1.2;
}

@media (max-width: 600px) {
    .pluv-stat-value {
        font-size: 1.3rem;
    }
}

.pluv-stat-label {
    font-size: 0.82rem;
    color: #8b95a3;
    font-weight: 500;
}

/* ---- Evolution Line Chart ---- */
.pluv-evolution {
    margin-top: 10px;
}

.pluv-evolution-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 4px 0;
    text-align: center;
}

.pluv-evolution-subtitle {
    font-size: 0.9rem;
    color: #8b95a3;
    text-align: center;
    margin: 0 0 24px 0;
}

.pluv-line-chart {
    position: relative;
    height: 200px;
    overflow: hidden;
}

@media (min-width: 768px) {
    .pluv-line-chart {
        height: 240px;
    }
}

.pluv-line-chart svg {
    width: 100%;
    height: 100%;
}

.pluv-line-path {
    fill: none;
    stroke: #0077b6;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pluv-line-area {
    fill: url(#pluv-gradient);
    opacity: 0.15;
}

.pluv-line-dot {
    fill: #0077b6;
    transition: r 0.2s;
    cursor: pointer;
}

.pluv-line-dot:hover {
    r: 5;
}

.pluv-line-dot.active {
    fill: #48cae4;
    stroke: #0077b6;
    stroke-width: 2;
    r: 6;
}

.pluv-line-label {
    fill: #8b95a3;
    font-size: 11px;
    text-anchor: middle;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.pluv-line-grid {
    stroke: #eef0f3;
    stroke-width: 1;
}

.pluv-line-grid-label {
    fill: #aab2bd;
    font-size: 10px;
    text-anchor: end;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Line chart tooltip */
.pluv-line-tooltip {
    position: absolute;
    background: #1a2a3a;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translate(-50%, -120%);
}

.pluv-line-tooltip.visible {
    opacity: 1;
}

/* ---- Loading state ---- */
.pluv-loading .pluv-bar {
    animation: pluv-pulse 1s ease-in-out infinite;
}

@keyframes pluv-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

/* ---- Responsive adjustments ---- */
.row .pluv-chart-container {
    width: 100%;
}

@media (max-width: 549px) {
    .pluv-bar-chart {
        height: 240px;
        gap: 3px;
    }

    .pluv-bar-label {
        font-size: 0.72rem;
    }

    .pluv-bar {
        width: 80%;
        border-radius: 5px 5px 3px 3px;
    }

    .pluv-tooltip {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
}
