/* ==========================================================================
   Datlaz Weather Alerts - CSS Design System & Stylesheet
   ========================================================================== */

/* Design Tokens & Variables */
:root {
    --bg-main: #f5f7fb;
    --bg-sidebar: #0c0e1a;
    --bg-card: #ffffff;
    --bg-card-glass: rgba(255, 255, 255, 0.9);
    
    --border-light: #e2e8f0;
    --border-glass: rgba(226, 232, 240, 0.8);
    --border-focus: #3b82f6;
    
    --text-dark-primary: #0f172a;   /* Slate 900 */
    --text-dark-secondary: #475569; /* Slate 600 */
    --text-dark-muted: #64748b;     /* Slate 500 */
    
    --text-light-primary: #f8fafc;
    --text-light-secondary: #94a3b8;
    --text-light-muted: #475569;
    
    /* Severity Colors (Light theme matching Datlaz) */
    --color-yellow: #d97706;        /* Amarelo escurecido para contraste */
    --color-yellow-bg: #fef3c7;
    --color-orange: #ea580c;
    --color-orange-bg: #ffedd5;
    --color-red: #dc2626;
    --color-red-bg: #fee2e2;
    
    --color-primary: #2563eb;
    --color-primary-bg: rgba(59, 130, 246, 0.08);
    
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-dark-primary);
    min-height: 100vh;
    overflow: hidden;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   Main App Layout
   ========================================================================== */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* ==========================================================================
   Sidebar Esquerda (Escura)
   ========================================================================== */
.app-sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    color: var(--text-light-secondary);
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    z-index: 20;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 0 4px;
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.logo-icon svg {
    width: 22px;
    height: 22px;
}

.logo-text h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: white;
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.logo-text span {
    font-size: 0.72rem;
    color: #475569;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Identificação de Usuário na Barra Lateral */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    margin-bottom: 8px;
}

.sidebar-user i {
    font-size: 1.6rem;
    color: var(--text-light-secondary);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
}

.user-role {
    font-size: 0.72rem;
    color: #475569;
}

.sidebar-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #475569;
    letter-spacing: 0.08em;
    margin: 12px 8px 8px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    color: #94a3b8;
    margin-bottom: 4px;
}

.sidebar-nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: white;
}

.sidebar-nav-item.active {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
    font-weight: 600;
}

.sidebar-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 12px 8px;
}

/* Layer Control Toggle Switch */
.sidebar-layers {
    padding: 0 4px;
}

.layer-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.layer-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #cbd5e1;
}

.layer-info i {
    color: #3b82f6;
}

/* Toggle Switch CSS (iOS Style) */
.switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #334155;
    transition: var(--transition-smooth);
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-smooth);
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--color-primary);
}

input:checked + .slider:before {
    transform: translateX(18px);
}

/* Sidebar Filters */
.sidebar-filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 4px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-group input,
.filter-group select {
    width: 100%;
    background-color: #111322;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 8px 12px;
    color: white;
    font-family: inherit;
    font-size: 0.82rem;
    outline: none;
    transition: var(--transition-smooth);
}

.filter-group input::placeholder {
    color: #475569;
}

.filter-group input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.search-input-wrapper {
    display: flex;
    gap: 6px;
    align-items: stretch;
    width: 100%;
}

.btn-search-go {
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

.btn-search-go:hover {
    background-color: #1d4ed8;
}

.filter-group input:focus,
.filter-group select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.filter-group select option {
    background-color: var(--bg-sidebar);
    color: white;
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.last-update {
    font-size: 0.75rem;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-refresh {
    background: #1e3a8a;
    color: #93c5fd;
    border: 1px solid #2563eb;
    border-radius: 8px;
    padding: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.btn-refresh:hover {
    background: #2563eb;
    color: white;
}

.btn-refresh.loading i {
    animation: spin 1s infinite linear;
}

/* ==========================================================================
   Main Content Area (Fundo Tela Cheia)
   ========================================================================== */
.app-main {
    flex-grow: 1;
    position: relative;
    height: 100vh;
    width: calc(100vw - 280px);
    overflow: hidden;
}

/* Fullscreen Map Container */
.map-fullscreen-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: #f8fafc;
}

/* Floating Elements Base */
.floating {
    z-index: 10;
    pointer-events: auto;
}

/* Feed de Avisos - Floating Card on the Left (Posicionado ao lado da barra lateral) */
.feed-wrapper.floating {
    position: absolute;
    top: 20px;
    left: 20px;
    right: auto;
    bottom: 20px;
    width: 350px;
    display: flex;
    flex-direction: column;
    background: var(--bg-card-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.08), 0 4px 12px -2px rgba(0, 0, 0, 0.03);
    max-height: calc(100vh - 40px);
    overflow: hidden;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), height 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-radius 0.3s, padding 0.3s, background-color 0.3s, top 0.3s, left 0.3s, right 0.3s;
}

.feed-wrapper.floating:hover {
    background: rgba(255, 255, 255, 0.95);
}

.feed-header {
    margin-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feed-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-dark-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.feed-header h2 i {
    color: var(--color-primary);
}

.feed-header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.alerts-count {
    background: #f1f5f9;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-dark-muted);
    border: 1px solid var(--border-light);
}

/* Minimizar/Fechar Feed Button */
.btn-toggle-feed {
    background: transparent;
    border: none;
    color: var(--text-dark-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 1rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.btn-toggle-feed:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-dark-primary);
}

/* Stats Panel Grid inside Feed Card */
.stats-panel-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.stat-mini-card {
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.stat-mini-card:hover {
    background: white;
    border-color: #cbd5e1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.stat-mini-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.stat-mini-info {
    display: flex;
    flex-direction: column;
}

.stat-mini-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark-primary);
    line-height: 1.1;
}

.stat-mini-label {
    font-size: 0.65rem;
    color: var(--text-dark-muted);
    font-weight: 500;
}

/* Accents for mini cards */
.stat-mini-card.total { border-left: 3px solid var(--color-primary); }
.stat-mini-card.total .stat-mini-icon { background: var(--color-primary-bg); color: var(--color-primary); }

.stat-mini-card.severity-yellow { border-left: 3px solid var(--color-yellow); }
.stat-mini-card.severity-yellow .stat-mini-icon { background: var(--color-yellow-bg); color: var(--color-yellow); }

.stat-mini-card.severity-orange { border-left: 3px solid var(--color-orange); }
.stat-mini-card.severity-orange .stat-mini-icon { background: var(--color-orange-bg); color: var(--color-orange); }

.stat-mini-card.severity-red { border-left: 3px solid var(--color-red); }
.stat-mini-card.severity-red .stat-mini-icon { background: var(--color-red-bg); color: var(--color-red); }

/* ==========================================================================
   Widget de Previsão de Tempo Customizado (Efeito Vidro/Datlaz Light)
   ========================================================================== */
.forecast-widget {
    background: rgba(37, 99, 235, 0.04);
    border: 1px solid rgba(37, 99, 235, 0.15);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
    animation: slideIn 0.25s ease-out;
}

.forecast-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px dashed rgba(37, 99, 235, 0.15);
}

.forecast-widget-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.forecast-widget-header h3 span {
    font-weight: 800;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-close-forecast {
    background: transparent;
    border: none;
    color: var(--text-dark-muted);
    cursor: pointer;
    font-size: 0.85rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    transition: var(--transition-smooth);
}

.btn-close-forecast:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-dark-primary);
}

.forecast-current {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.forecast-main {
    display: flex;
    flex-direction: column;
}

.forecast-temp {
    font-family: 'Outfit', sans-serif;
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text-dark-primary);
    line-height: 1.1;
}

.forecast-condition {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-dark-secondary);
}

.forecast-details-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    font-size: 0.72rem;
    color: var(--text-dark-muted);
    font-weight: 500;
    text-align: right;
}

.forecast-detail-item i {
    color: var(--color-primary);
    width: 14px;
    text-align: center;
    margin-right: 2px;
}

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

.forecast-day-card {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: default;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    animation: slideIn 0.2s ease-out;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.forecast-day-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: var(--color-primary);
}

.forecast-day-card:hover {
    background: white;
    transform: translateY(-1px);
    border-color: #cbd5e1;
    box-shadow: 0 4px 10px -2px rgba(0, 0, 0, 0.05);
}

.forecast-day-card.rain-day::before { background: #3b82f6; }
.forecast-day-card.hot-day::before { background: #ef4444; }
.forecast-day-card.storm-day::before { background: #f97316; }

/* Forecast Day Card - Internal Elements */
.fdc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fdc-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fdc-title .fdc-icon {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: var(--color-primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--color-primary);
    flex-shrink: 0;
}

.fdc-title .fdc-day-info h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dark-primary);
    line-height: 1.2;
}

.fdc-title .fdc-day-info span {
    font-size: 0.65rem;
    color: var(--text-dark-muted);
    font-weight: 500;
}

.fdc-temp-main {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-dark-primary);
    white-space: nowrap;
    text-align: right;
}

.fdc-temp-main small {
    font-size: 0.62rem;
    font-weight: 500;
    color: var(--text-dark-muted);
    display: block;
}

.fdc-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 10px;
    padding-top: 5px;
    border-top: 1px solid #f1f5f9;
}

.fdc-detail {
    font-size: 0.67rem;
    color: var(--text-dark-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    padding: 2px 0;
}

.fdc-detail i {
    width: 13px;
    text-align: center;
    font-size: 0.6rem;
    color: var(--text-dark-muted);
    flex-shrink: 0;
}

.fdc-detail .fdc-val {
    font-weight: 700;
    color: var(--text-dark-primary);
}

.fdc-detail.rain-highlight {
    color: #2563eb;
}

.fdc-detail.rain-highlight i {
    color: #3b82f6;
}

.fdc-detail.rain-highlight .fdc-val {
    color: #1d4ed8;
}

/* ==========================================================================
   Widget de Energia Solar Histórico (Datlaz Solar Glass)
   ========================================================================== */
.solar-widget {
    background: rgba(245, 158, 11, 0.04);
    border: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
    animation: slideIn 0.25s ease-out;
}

.solar-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px dashed rgba(245, 158, 11, 0.15);
}

.solar-widget-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: #d97706; /* Amarelo escuro solar */
    display: flex;
    align-items: center;
    gap: 6px;
}

.solar-widget-header h3 span {
    font-weight: 800;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-close-solar {
    background: transparent;
    border: none;
    color: var(--text-dark-muted);
    cursor: pointer;
    font-size: 0.85rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    transition: var(--transition-smooth);
}

.btn-close-solar:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-dark-primary);
}

.solar-date-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(245, 158, 11, 0.08);
    color: #b45309;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.solar-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.solar-stat-card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: var(--transition-smooth);
}

.solar-stat-card:hover {
    transform: translateY(-1px);
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow: 0 2px 5px rgba(245, 158, 11, 0.05);
}

.solar-stat-val {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-dark-primary);
}

.solar-sub-val {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-dark-muted);
    display: block;
    margin-top: 1px;
}

.solar-stat-lbl {
    font-size: 0.62rem;
    color: var(--text-dark-muted);
    font-weight: 500;
}

/* Estilizações de Destaque para cada Tipo de Cartão */
.solar-stat-card.ghi:hover {
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.05);
}
.solar-stat-card.ghi i {
    color: #f59e0b;
}

.solar-stat-card.dni:hover {
    border-color: rgba(234, 88, 12, 0.4);
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.05);
}
.solar-stat-card.dni i {
    color: #ea580c;
}

.solar-stat-card.precipitation:hover {
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.05);
}
.solar-stat-card.precipitation i {
    color: #3b82f6;
}

.solar-stat-card.temperature:hover {
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.05);
}
.solar-stat-card.temperature i {
    color: #ef4444;
}

/* Seção de Alertas na Ficha Histórica */
.solar-alerts-header {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-dark-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-top: 14px;
    margin-bottom: 8px;
}

.solar-alerts-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 4px;
}

.solar-alert-mini-card {
    background: white;
    border-left: 3.5px solid #cbd5e1;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.72rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-light);
}

.solar-alert-mini-card.yellow {
    border-left-color: var(--color-yellow);
    background: var(--color-yellow-bg);
}

.solar-alert-mini-card.orange {
    border-left-color: var(--color-orange);
    background: var(--color-orange-bg);
}

.solar-alert-mini-card.red {
    border-left-color: var(--color-red);
    background: var(--color-red-bg);
}

.solar-alert-mini-card.blue {
    border-left-color: #3b82f6;
    background: #eff6ff;
}

.solar-alert-mini-card.gray {
    border-left-color: #64748b;
    background: #f8fafc;
}

.solar-alert-mini-title {
    font-weight: 700;
    color: var(--text-dark-primary);
}

.solar-alert-mini-time {
    font-size: 0.65rem;
    color: var(--text-dark-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.alert-status-none {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: #16a34a;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 8px;
    border-radius: 6px;
}

.alert-status-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 8px;
    border-radius: 6px;
    line-height: 1.3;
}

.btn-export-csv {
    display: flex;
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    background: #16a34a;
    color: white;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--transition-smooth);
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.2);
}

.btn-export-csv:hover {
    background: #15803d;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
    transform: translateY(-1px);
}

.btn-export-csv:active {
    transform: translateY(0);
}

/* Abas de Busca */
.search-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    background: #e2e8f0;
    padding: 3px;
    border-radius: 6px;
}

.search-tab-btn {
    flex: 1;
    border: none;
    padding: 6px;
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition-smooth);
    background: transparent;
    color: var(--text-dark-muted);
}

.search-tab-btn.active {
    background: var(--bg-card);
    color: var(--text-dark-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Seletor de Modo Histórico */
.history-mode-selector {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    background: #e2e8f0;
    padding: 3px;
    border-radius: 6px;
}

.history-mode-btn {
    flex: 1;
    border: none;
    padding: 6px;
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition-smooth);
    background: transparent;
    color: var(--text-dark-muted);
}

.history-mode-btn.active {
    background: var(--bg-card);
    color: var(--text-dark-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}



/* Gráfico de Barras Solar */
.solar-chart-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-dark-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 8px;
}

.solar-chart-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 90px;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 10px 14px 6px;
    gap: 4px;
}

.solar-bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
    height: 100%;
    justify-content: flex-end;
    position: relative;
}

.solar-bar {
    width: 16px;
    background: linear-gradient(to top, #f59e0b, #fbbf24);
    border-radius: 3px 3px 0 0;
    transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
}

.solar-bar:hover {
    background: #ea580c;
}

/* Tooltip para mostrar o valor exato ao passar o mouse */
.solar-bar::after {
    content: attr(data-val);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translate(-50%, -6px) scale(0.85);
    background: rgba(15, 23, 42, 0.9);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.solar-bar:hover::after {
    opacity: 1;
    transform: translate(-50%, -6px) scale(1);
}

.solar-bar-label {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-dark-muted);
    margin-top: 4px;
}

/* ==========================================================================
   Details Wrapper (Forecast / Solar History) - Floating on the Right
   ========================================================================== */
.details-wrapper.floating {
    position: absolute;
    top: 20px;
    right: 20px;
    left: auto;
    bottom: 80px;
    width: 365px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    z-index: 10;
    display: flex;
    flex-direction: column;
    background: var(--bg-card-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.08), 0 4px 12px -2px rgba(0, 0, 0, 0.03);
    transition: var(--transition-smooth);
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.details-wrapper.floating:hover {
    background: rgba(255, 255, 255, 0.95);
}

.details-wrapper .solar-widget,
.details-wrapper .forecast-widget {
    margin-bottom: 0;
    animation: none;
    background: transparent;
    border: none;
    padding: 0;
}

/* ==========================================================================
   Collapsed State for Feed (Glass round button)
   ========================================================================== */
.feed-wrapper.floating.collapsed {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    padding: 0;
    top: 20px; /* Alinhado no topo esquerdo do mapa */
    bottom: auto;
    left: 20px;
    right: auto;
    overflow: hidden;
    cursor: pointer;
    background: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.feed-wrapper.floating.collapsed:hover {
    background: #1d4ed8;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}

.feed-wrapper.floating.collapsed .card-header {
    border: none;
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feed-wrapper.floating.collapsed .card-header h2,
.feed-wrapper.floating.collapsed .alerts-count,
.feed-wrapper.floating.collapsed .stats-panel-grid,
.feed-wrapper.floating.collapsed .forecast-widget,
.feed-wrapper.floating.collapsed .alerts-list,
.feed-wrapper.floating.collapsed .map-legend {
    display: none !important;
}

.feed-wrapper.floating.collapsed #btn-toggle-feed {
    color: white !important;
    background: transparent !important;
    font-size: 1.15rem;
    pointer-events: none; /* Make clicking the whole circle trigger expand */
    padding: 0;
}

.alerts-list {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

.empty-feed {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 80px 20px;
    color: var(--text-dark-muted);
    text-align: center;
}

.empty-feed i {
    font-size: 2.2rem;
    color: #cbd5e1;
}

.empty-feed p {
    font-size: 0.82rem;
}

/* Alert Item Card inside Feed */
.alert-card {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    animation: slideIn 0.2s ease-out;
}

.alert-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: var(--color-primary);
}

.alert-card:hover {
    background: white;
    transform: translateY(-1px);
    border-color: #cbd5e1;
    box-shadow: 0 4px 10px -2px rgba(0, 0, 0, 0.05);
}

/* Cards Severity Styles */
.alert-card.yellow::before { background: #f59e0b; }
.alert-card.yellow:hover { box-shadow: 0 4px 12px rgba(245, 158, 11, 0.06); }

.alert-card.orange::before { background: #f97316; }
.alert-card.orange:hover { box-shadow: 0 4px 12px rgba(249, 115, 22, 0.06); }

.alert-card.red::before { background: #ef4444; }
.alert-card.red:hover { box-shadow: 0 4px 12px rgba(239, 68, 68, 0.06); }

/* Card Internals */
.alert-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}

.alert-title-group h3 {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-dark-primary);
    line-height: 1.3;
}

.alert-badge {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-top: 2px;
}

.alert-card.yellow .alert-badge { background: var(--color-yellow-bg); color: var(--color-yellow); }
.alert-card.orange .alert-badge { background: var(--color-orange-bg); color: var(--color-orange); }
.alert-card.red .alert-badge { background: var(--color-red-bg); color: var(--color-red); }

.alert-location {
    font-size: 0.74rem;
    color: var(--text-dark-secondary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

.alert-location i {
    color: #64748b;
}

.alert-time {
    font-size: 0.7rem;
    color: var(--text-dark-muted);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 6px;
}

.alert-preview-text {
    font-size: 0.76rem;
    color: var(--text-dark-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

/* Selected/Active Alert Card */
.alert-card.active {
    background: white;
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.08);
}
.alert-card.active .alert-preview-text {
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
}
.alert-card.yellow.active { border-color: #f59e0b; }
.alert-card.orange.active { border-color: #f97316; }
.alert-card.red.active { border-color: #ef4444; }

/* Legend (Inside floating feed card) */
.map-legend {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
    font-size: 0.7rem;
    color: var(--text-dark-muted);
    font-weight: 500;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
}

.legend-color.yellow { background-color: #f59e0b; }
.legend-color.orange { background-color: #f97316; }
.legend-color.red { background-color: #ef4444; }

/* ==========================================================================
   Leaflet Map Popups Styling (Claro)
   ========================================================================== */
.leaflet-popup-content-wrapper {
    background: white !important;
    color: var(--text-dark-primary) !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04) !important;
    border: 1px solid var(--border-light);
    padding: 2px;
}

.leaflet-popup-tip {
    background: white !important;
}

.leaflet-container a.leaflet-popup-close-button {
    color: var(--text-dark-muted) !important;
    padding: 6px 10px 0 0 !important;
}

.map-popup-content {
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 260px;
}

.map-popup-header {
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 6px;
    margin-bottom: 2px;
}

.map-popup-header h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-dark-primary);
    margin-bottom: 2px;
}

.map-popup-severity {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
}

.map-popup-severity.yellow { color: var(--color-yellow); }
.map-popup-severity.orange { color: var(--color-orange); }
.map-popup-severity.red { color: var(--color-red); }

.map-popup-time {
    font-size: 0.7rem;
    color: var(--text-dark-muted);
}

.map-popup-text {
    font-size: 0.74rem;
    color: var(--text-dark-secondary);
    line-height: 1.4;
}

.map-popup-btn {
    align-self: flex-start;
    background: var(--color-primary);
    color: white;
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    margin-top: 4px;
    transition: var(--transition-smooth);
}

.map-popup-btn:hover {
    background: #1d4ed8;
}

/* ==========================================================================
   Animations & Responsive
   ========================================================================== */
@keyframes spin {
    to { transform: rotate(360deg); }
}

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

.animate-pulse {
    animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Responsive Rules */
@media (max-width: 900px) {
    .app-layout {
        flex-direction: column;
    }
    
    .app-sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        padding: 16px;
    }
    
    .app-main {
        width: 100vw;
        height: calc(100vh - 200px);
    }
    
    .feed-wrapper.floating {
        position: relative;
        top: 20px;
        left: 10px;
        right: 10px;
        bottom: auto;
        width: calc(100vw - 20px);
        max-height: 400px;
    }
}

/* ==========================================================================
   Locais Favoritos (Sidebar)
   ========================================================================== */
.sidebar-favorites {
    padding: 0 4px;
    min-height: 85px;
    max-height: 260px;
    flex-shrink: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.favorites-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    font-size: 0.72rem;
    color: #475569;
    line-height: 1.4;
}

.favorites-empty i:first-child {
    font-size: 1rem;
    color: #334155;
    flex-shrink: 0;
}

.favorites-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.favorite-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
    animation: favSlideIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.favorite-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, #f59e0b, #d97706);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.favorite-item:hover {
    background: rgba(245, 158, 11, 0.06);
    border-color: rgba(245, 158, 11, 0.2);
    transform: translateX(2px);
}

.favorite-item:hover::before {
    opacity: 1;
}

.favorite-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.favorite-item-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.favorite-item-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: rgba(245, 158, 11, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.75rem;
    color: #f59e0b;
    transition: var(--transition-smooth);
}

.favorite-item:hover .favorite-item-icon {
    background: rgba(245, 158, 11, 0.22);
    color: #fbbf24;
}

.favorite-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.favorite-item-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.favorite-item-coords {
    font-size: 0.62rem;
    color: #64748b;
    font-weight: 500;
}

.favorite-item-remove {
    background: transparent;
    border: none;
    color: #475569;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 4px 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

.favorite-item:hover .favorite-item-remove {
    opacity: 1;
}

.favorite-item-remove:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Dynamic Weather Alert Badge on Favorites */
.favorite-item-alert-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.67rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    margin-top: 2px;
    line-height: 1.2;
}

.favorite-item-alert-badge.rain {
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.favorite-item-alert-badge.clear {
    background: rgba(34, 197, 94, 0.08);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.favorite-item-alert-badge.severe {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ==========================================================================
   Botão Favoritar no Widget de Previsão
   ========================================================================== */
.forecast-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-fav-forecast {
    background: transparent;
    border: none;
    color: var(--text-dark-muted);
    cursor: pointer;
    font-size: 0.9rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    transition: var(--transition-smooth);
}

.btn-fav-forecast:hover {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    transform: scale(1.15);
}

.btn-fav-forecast.active {
    color: #f59e0b;
}

.btn-fav-forecast.active i {
    font-weight: 900;
}

@keyframes favStarPop {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.4); }
    60%  { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.btn-fav-forecast.pop {
    animation: favStarPop 0.4s ease-out;
}

@keyframes favSlideIn {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Toast Notification Styles */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: #0f172a;
    color: white;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), toastOut 0.3s 2.7s ease-in forwards;
    pointer-events: auto;
}

.toast.success i { color: #f59e0b; }
.toast.info i { color: #3b82f6; }
.toast.warn i { color: #ef4444; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-12px) scale(0.95); }
}

/* ==========================================================================
   Botão de Atalho para Favoritos na Sidebar
   ========================================================================== */
.btn-toggle-favorites-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 10px;
    color: #e2e8f0;
    cursor: pointer;
    width: 100%;
    transition: var(--transition-smooth);
    text-align: left;
}

.btn-toggle-favorites-panel:hover {
    background: rgba(245, 158, 11, 0.16);
    border-color: rgba(245, 158, 11, 0.4);
    transform: translateY(-1px);
}

.btn-toggle-favorites-panel.active {
    background: rgba(245, 158, 11, 0.22);
    border-color: #f59e0b;
}

.btn-fav-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.btn-fav-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.btn-fav-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: #f8fafc;
}

.btn-fav-sub {
    font-size: 0.68rem;
    color: #94a3b8;
    font-weight: 500;
}

.btn-fav-arrow {
    font-size: 0.75rem;
    color: #64748b;
    transition: transform 0.2s ease;
}

.btn-toggle-favorites-panel:hover .btn-fav-arrow {
    color: #f59e0b;
    transform: translateX(3px);
}

/* ==========================================================================
   Painel Flutuante de Favoritos (Favorites Wrapper Floating Panel)
   ========================================================================== */
.favorites-wrapper.floating {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 400px;
    max-height: calc(100vh - 80px);
    z-index: 25;
    display: flex;
    flex-direction: column;
    background: var(--bg-card-glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 14px 35px -5px rgba(0, 0, 0, 0.25), 0 4px 14px -2px rgba(0, 0, 0, 0.1);
    transition: var(--transition-smooth);
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 1200px) {
    .favorites-wrapper.floating {
        left: 20px;
        right: auto;
        width: 380px;
    }
}

@media (max-width: 900px) {
    .favorites-wrapper.floating {
        position: relative;
        top: 10px;
        left: 10px;
        right: 10px;
        width: calc(100vw - 20px);
    }
}

.favorites-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 12px;
}

.favorites-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-dark-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.favorites-header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fav-badge-count {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.btn-close-favorites {
    background: transparent;
    border: none;
    color: var(--text-dark-muted);
    cursor: pointer;
    font-size: 1rem;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.btn-close-favorites:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-dark-primary);
}

.favorites-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    max-height: calc(100vh - 180px);
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}

.fav-monitoring-summary {
    background: rgba(37, 99, 235, 0.05);
    border: 1px solid rgba(37, 99, 235, 0.15);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.72rem;
    color: #1e40af;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.fav-monitoring-summary i {
    font-size: 0.9rem;
    color: #2563eb;
    flex-shrink: 0;
}

.favorites-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.favorites-panel-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.5);
    border: 1px dashed var(--border-light);
    border-radius: 10px;
    gap: 8px;
}

.favorites-panel-empty i {
    font-size: 2rem;
    color: #cbd5e1;
}

.favorites-panel-empty p {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-dark-primary);
}

.favorites-panel-empty span {
    font-size: 0.72rem;
    color: var(--text-dark-muted);
}

.btn-demo-curitiba {
    margin-top: 8px;
    padding: 8px 14px;
    font-size: 0.78rem;
    font-weight: 700;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    transition: var(--transition-smooth);
}

.btn-demo-curitiba:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}

/* ==========================================================================
   Caixa do Favorito Ricos (Favorite Card Box)
   ========================================================================== */
.favorite-card-box {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.favorite-card-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: #f59e0b;
}

.favorite-card-box:hover {
    background: white;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -2px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

.favorite-card-box.has-alert::before {
    background: #ef4444;
}

.fcb-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.fcb-location {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fcb-star-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.fcb-titles h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-dark-primary);
    line-height: 1.2;
}

.fcb-titles span {
    font-size: 0.65rem;
    color: var(--text-dark-muted);
    font-weight: 500;
}

.fcb-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.fcb-btn-action {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    transition: var(--transition-smooth);
}

.fcb-btn-action:hover {
    background: #f1f5f9;
    color: var(--text-dark-primary);
}

.fcb-btn-action.btn-cfg:hover {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

.fcb-btn-action.btn-del:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Clima do Dia Corrente na Caixa */
.fcb-weather-today {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(248, 250, 252, 0.8);
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    padding: 8px 12px;
}

.fcb-wt-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fcb-wt-temp {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-dark-primary);
    line-height: 1;
}

.fcb-wt-cond {
    display: flex;
    flex-direction: column;
}

.fcb-wt-cond span {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-dark-secondary);
}

.fcb-wt-cond small {
    font-size: 0.62rem;
    color: var(--text-dark-muted);
}

.fcb-wt-metrics {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    font-size: 0.68rem;
    color: var(--text-dark-secondary);
    font-weight: 500;
}

.fcb-wt-metrics i {
    font-size: 0.62rem;
    color: var(--text-dark-muted);
    width: 12px;
    text-align: center;
}

/* Badges de Status de Alerta Customizado */
.fcb-alert-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.3;
}

.fcb-alert-badge.status-alert {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.fcb-alert-badge.status-rain {
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.fcb-alert-badge.status-clear {
    background: rgba(34, 197, 94, 0.08);
    color: #15803d;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

/* ==========================================================================
   Modal de Configuração de Alertas de Favorito (Favorite Config Modal)
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

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

.modal-card {
    background: white;
    border-radius: 14px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
}

.modal-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-dark-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-modal-close {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 1rem;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.btn-modal-close:hover {
    background: #e2e8f0;
    color: var(--text-dark-primary);
}

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: calc(85vh - 120px);
    overflow-y: auto;
}

.modal-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-label {
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-dark-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Selector de Período */
.period-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.period-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-dark-secondary);
    transition: var(--transition-smooth);
}

.period-option:has(input:checked) {
    background: rgba(37, 99, 235, 0.08);
    border-color: #2563eb;
    color: #1d4ed8;
}

.period-option input {
    accent-color: #2563eb;
}

/* Switch & Controls */
.config-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
}

.toggle-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-info i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.toggle-info div {
    display: flex;
    flex-direction: column;
}

.toggle-info strong {
    font-size: 0.8rem;
    color: var(--text-dark-primary);
}

.toggle-info small {
    font-size: 0.68rem;
    color: var(--text-dark-muted);
}

/* Switch Toggle UI */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .2s;
    border-radius: 22px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .2s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2563eb;
}

input:checked + .slider:before {
    transform: translateX(18px);
}

.config-sub-input {
    margin-top: -6px;
    margin-left: 12px;
    padding: 8px 12px;
    background: #f1f5f9;
    border-radius: 6px;
    font-size: 0.72rem;
    color: var(--text-dark-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.unit-input-wrapper {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 2px 8px;
}

.unit-input-wrapper input {
    width: 50px;
    border: none;
    outline: none;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-dark-primary);
    text-align: right;
}

.unit-input-wrapper .unit {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-dark-muted);
    margin-left: 4px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
}

.btn-modal-cancel {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: var(--text-dark-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-modal-cancel:hover {
    background: #e2e8f0;
}

.btn-modal-save {
    background: #2563eb;
    color: white;
    border: none;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 8px 18px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    transition: var(--transition-smooth);
}

.btn-modal-save:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

/* ==========================================================================
   Botão Importar Geoespacial no Header de Favoritos
   ========================================================================== */
.btn-import-geo {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #a78bfa;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
}
.btn-import-geo:hover {
    background: rgba(139, 92, 246, 0.25);
    color: #c4b5fd;
    border-color: rgba(139, 92, 246, 0.5);
}

/* ==========================================================================
   Modal de Importação Geoespacial
   ========================================================================== */
.geo-import-card {
    width: 600px;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}
.geo-import-card .modal-body {
    overflow-y: auto;
    padding: 20px;
    flex: 1;
}

.geo-step {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Dropzone */
.geo-dropzone {
    border: 2px dashed rgba(139, 92, 246, 0.4);
    border-radius: 12px;
    background: rgba(139, 92, 246, 0.05);
    padding: 36px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.geo-dropzone:hover,
.geo-dropzone.dragover {
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.12);
    transform: scale(1.01);
}
.geo-dropzone-icon {
    font-size: 2.5rem;
    color: #8b5cf6;
    margin-bottom: 4px;
}
.geo-dropzone-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}
.geo-dropzone-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}
.geo-formats-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 8px;
}
.geo-format-badge {
    padding: 3px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #a78bfa;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 20px;
}
.geo-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 10px 14px;
    margin: 0;
    line-height: 1.5;
}
.geo-hint strong { color: var(--text-secondary); }

/* Loading Spinner */
.geo-loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 48px 0;
    color: var(--text-secondary);
}
.geo-loading-spinner p {
    margin: 0;
    font-size: 0.9rem;
}

/* Preview */
.geo-config-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
}
.geo-config-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.geo-config-item label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}
.geo-select {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    outline: none;
}
.geo-feat-count {
    font-size: 0.78rem;
    font-weight: 600;
    color: #a78bfa;
    padding: 4px 10px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(139, 92, 246, 0.25);
}
.geo-preview-actions {
    display: flex;
    gap: 8px;
}
.geo-btn-select-all,
.geo-btn-deselect-all {
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.18s;
    display: flex;
    align-items: center;
    gap: 5px;
}
.geo-btn-select-all {
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.geo-btn-select-all:hover { background: rgba(16, 185, 129, 0.22); }
.geo-btn-deselect-all {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.25);
}
.geo-btn-deselect-all:hover { background: rgba(239, 68, 68, 0.2); }

/* Lista de Features */
.geo-features-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}
.geo-feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.geo-feature-item:hover {
    background: rgba(139, 92, 246, 0.08);
    border-color: rgba(139, 92, 246, 0.25);
}
.geo-feature-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: #8b5cf6;
    cursor: pointer;
    flex-shrink: 0;
}
.geo-feature-icon {
    font-size: 1rem;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.geo-feature-icon.point { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.geo-feature-icon.polygon { background: rgba(139, 92, 246, 0.15); color: #c4b5fd; }
.geo-feature-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.geo-feature-name {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.geo-feature-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Card de Favorito do tipo Polígono */
.favorite-card-box.fav-polygon .fcb-star-icon {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}
.favorite-card-box.fav-polygon .fcb-header {
    border-bottom-color: rgba(139, 92, 246, 0.15);
}
/* ==========================================================================
   Suporte a Janelas Flutuantes Móveis (Draggable Handles)
   ========================================================================== */
.draggable-handle {
    cursor: grab !important;
    user-select: none;
    -webkit-user-select: none;
}
.draggable-handle:active {
    cursor: grabbing !important;
}
.draggable-handle h2,
.draggable-handle h3,
.draggable-handle span,
.draggable-handle div {
    user-select: none;
    -webkit-user-select: none;
}

