/* ==============================================================================
   DISEÑO PREMIUM DE TENDENCIAS OSCURAS Y GLASSMORPHISM (MADRID TEMPERATURE)
   ============================================================================== */

:root {
    --bg-color: #0b0f19;
    --card-bg: rgba(22, 30, 49, 0.7);
    --card-border: rgba(40, 54, 85, 0.5);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --cyan: #00f0ff;
    --orange: #ff9f1c;
    --red: #ff4d6d;
    --green: #2ec4b6;
    --gray: #64748b;
    --purple: #a855f7;
    --font-sans: 'Outfit', sans-serif;
    --shadow-neon-cyan: 0 0 15px rgba(0, 240, 255, 0.25);
    --shadow-neon-orange: 0 0 15px rgba(255, 159, 28, 0.25);
    --shadow-neon-red: 0 0 15px rgba(255, 77, 109, 0.25);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ==============================================================================
   SIDEBAR
   ============================================================================== */
.sidebar {
    width: 320px;
    background-color: rgba(13, 18, 30, 0.95);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--card-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.logo-icon {
    color: var(--cyan);
    filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.6));
}

.logo-sub {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1.5px;
    margin-top: 4px;
    display: block;
}

.section-title {
    padding: 20px 24px 8px 24px;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1.5px;
    font-weight: 600;
}

.event-list {
    list-style: none;
    overflow-y: auto;
    flex-grow: 1;
    padding: 0 16px 20px 16px;
}

.event-list::-webkit-scrollbar {
    width: 6px;
}

.event-list::-webkit-scrollbar-thumb {
    background-color: var(--card-border);
    border-radius: 4px;
}

.event-item {
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    background: rgba(30, 41, 59, 0.2);
    border: 1px solid transparent;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.event-item:hover {
    background: rgba(30, 41, 59, 0.5);
    border-color: rgba(40, 54, 85, 0.8);
    transform: translateY(-2px);
}

.event-item.active {
    background: rgba(0, 240, 255, 0.08);
    border-color: var(--cyan);
    box-shadow: var(--shadow-neon-cyan);
}

.event-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.event-item-date {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.event-item-title {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 9999px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-active {
    background-color: rgba(46, 196, 182, 0.15);
    color: var(--green);
    border: 1px solid rgba(46, 196, 182, 0.3);
}

.badge-resolved {
    background-color: rgba(100, 116, 139, 0.15);
    color: var(--text-secondary);
    border: 1px solid rgba(100, 116, 139, 0.3);
}

.loading-placeholder {
    color: var(--text-secondary);
    text-align: center;
    padding: 40px 0;
    font-size: 14px;
}

/* ==============================================================================
   MAIN CONTENT
   ============================================================================== */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
    overflow-y: auto;
    position: relative;
}

.topbar {
    padding: 24px 32px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.text-muted {
    color: var(--text-secondary);
}

.small {
    font-size: 12px;
}

.system-status {
    display: flex;
    gap: 12px;
}

.status-badge {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
}

.status-connected {
    background: rgba(46, 196, 182, 0.08);
    color: var(--green);
    border-color: rgba(46, 196, 182, 0.3);
}

.status-disconnected {
    background: rgba(255, 77, 109, 0.08);
    color: var(--red);
    border-color: rgba(255, 77, 109, 0.3);
}

/* ==============================================================================
   DASHBOARD GRID & CARDS
   ============================================================================== */
.dashboard-grid {
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    flex-grow: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.hidden {
    display: none !important;
}

.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Metrics Row */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.metric-card {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.metric-card:hover {
    transform: translateY(-2px);
}

.glowing-cyan:hover {
    box-shadow: var(--shadow-neon-cyan);
    border-color: var(--cyan);
}

.glowing-orange:hover {
    box-shadow: var(--shadow-neon-orange);
    border-color: var(--orange);
}

.glowing-red:hover {
    box-shadow: var(--shadow-neon-red);
    border-color: var(--red);
}

.metric-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
}

.glowing-cyan .metric-icon { color: var(--cyan); border-color: rgba(0, 240, 255, 0.3); }
.glowing-orange .metric-icon { color: var(--orange); border-color: rgba(255, 159, 28, 0.3); }
.glowing-red .metric-icon { color: var(--red); border-color: rgba(255, 77, 109, 0.3); }

.metric-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.metric-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    font-weight: 600;
}

.metric-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 4px;
}

.metric-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 999px;
    margin-top: 8px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--orange), #ff4d6d);
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==============================================================================
   ALERT BOX
   ============================================================================== */
.alert-box {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 28px;
    background: rgba(255, 159, 28, 0.08);
    border: 1px solid rgba(255, 159, 28, 0.4);
    border-radius: 16px;
    box-shadow: 0 0 20px rgba(255, 159, 28, 0.1);
}

.alert-icon-pulse {
    font-size: 26px;
    color: var(--orange);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(255, 159, 28, 0.5)); }
    50% { transform: scale(1.15); filter: drop-shadow(0 0 10px rgba(255, 159, 28, 0.8)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(255, 159, 28, 0.5)); }
}

.alert-content h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--orange);
    margin-bottom: 2px;
}

.alert-content p {
    font-size: 13px;
    color: var(--text-primary);
}

/* Content Row: Chart & Ranges / Lists */
.content-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
}

.content-row-three {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

.breakout-alerts-list {
    list-style: none;
    padding: 16px 24px;
    max-height: 280px;
    overflow-y: auto;
}

.breakout-alert-item {
    padding: 12px 16px;
    border-radius: 10px;
    background: rgba(255, 159, 28, 0.05);
    border: 1px solid rgba(255, 159, 28, 0.2);
    margin-bottom: 8px;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.breakout-alert-item:hover {
    background: rgba(255, 159, 28, 0.1);
    border-color: rgba(255, 159, 28, 0.4);
}

.breakout-alert-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.breakout-alert-type {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 700;
}

.type-momentum {
    background: rgba(0, 240, 255, 0.1);
    color: var(--cyan);
    border: 1px solid rgba(0, 240, 255, 0.2);
}

.type-aemet {
    background: rgba(255, 77, 109, 0.1);
    color: var(--red);
    border: 1px solid rgba(255, 77, 109, 0.2);
}

.breakout-alert-msg {
    color: var(--text-primary);
    line-height: 1.4;
}

.breakout-alert-time {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: monospace;
    align-self: flex-end;
}


.panel-header {
    padding: 24px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-header h3 i {
    color: var(--cyan);
}

.chart-panel {
    display: flex;
    flex-direction: column;
}

.chart-wrapper {
    padding: 24px;
    flex-grow: 1;
    position: relative;
    height: 380px;
}

.ranges-panel {
    display: flex;
    flex-direction: column;
}

.table-wrapper {
    overflow-y: auto;
    flex-grow: 1;
    max-height: 380px;
}

.premium-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

.premium-table th {
    padding: 16px 24px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--card-border);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
}

.premium-table td {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(40, 54, 85, 0.2);
    font-weight: 500;
}

.premium-table tr:last-child td {
    border-bottom: none;
}

.premium-table tr:hover td {
    background-color: rgba(30, 41, 59, 0.25);
}

.price-text-yes {
    color: var(--cyan);
    font-weight: 700;
    font-size: 15px;
}

/* AEMET History List */
.aemet-history-list {
    list-style: none;
    padding: 16px 24px;
    max-height: 280px;
    overflow-y: auto;
}

.aemet-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 10px;
    background: rgba(30, 41, 59, 0.15);
    margin-bottom: 8px;
    font-size: 13px;
    border: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.aemet-history-item:hover {
    border-color: rgba(255, 77, 109, 0.3);
}

.aemet-hist-time {
    color: var(--text-secondary);
    font-family: monospace;
}

.aemet-hist-temp {
    color: var(--red);
    font-weight: 700;
    font-size: 15px;
}

/* Telegram settings panel */
.settings-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.form-group textarea {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 12px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    resize: none;
    height: 80px;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-group textarea:focus {
    border-color: var(--cyan);
}

.premium-btn {
    background: linear-gradient(135deg, #0077b6, #00b4d8);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: opacity 0.2s ease, transform 0.1s ease;
    box-shadow: 0 4px 14px rgba(0, 180, 216, 0.3);
}

.premium-btn:hover {
    opacity: 0.9;
}

.premium-btn:active {
    transform: scale(0.98);
}

.test-result {
    font-size: 12px;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.test-result.success {
    background: rgba(46, 196, 182, 0.1);
    color: var(--green);
    border: 1px solid rgba(46, 196, 182, 0.2);
}

.test-result.error {
    background: rgba(255, 77, 109, 0.1);
    color: var(--red);
    border: 1px solid rgba(255, 77, 109, 0.2);
}

/* ==============================================================================
   WELCOME SCREEN
   ============================================================================== */
.welcome-screen {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.welcome-icon {
    font-size: 80px;
    color: var(--card-border);
    margin-bottom: 24px;
    filter: drop-shadow(0 0 10px rgba(40, 54, 85, 0.3));
}

.welcome-screen h2 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 8px;
}

.welcome-screen p {
    color: var(--text-secondary);
    font-size: 15px;
    max-width: 480px;
    line-height: 1.5;
    margin-bottom: 24px;
}

.pulse-indicator {
    font-size: 12px;
    color: var(--cyan);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: subtle-pulse 2s infinite;
}

@keyframes subtle-pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* ==============================================================================
   SCROLLBAR GLOBAL
   ============================================================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray);
}

/* ==============================================================================
   NUEVOS ESTILOS: CALENDARIO, BRAND WRAPPER Y SIDEBAR TOGGLE
   ============================================================================== */

/* Sidebar Brand Wrapper */
.sidebar-brand-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Toggle Buttons */
.sidebar-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    margin-right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}

.sidebar-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--cyan);
}

.sidebar-close-btn {
    display: none; /* Oculto por defecto en desktop */
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background-color 0.2s;
}

.sidebar-close-btn:hover {
    color: var(--red);
    background-color: rgba(255, 77, 109, 0.1);
}

/* Sidebar transitions */
.sidebar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
    width: 0 !important;
    padding: 0 !important;
    border-right: none !important;
    overflow: hidden !important;
}

/* Calendar Container */
.calendar-container {
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 6px 12px;
}

.calendar-month-year {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: capitalize;
}

.cal-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 11px;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background-color 0.2s;
}

.cal-btn:hover {
    color: var(--cyan);
    background-color: rgba(255, 255, 255, 0.05);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

/* Individual Days */
.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    color: var(--gray);
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.cal-day.empty {
    cursor: default;
    background: transparent !important;
    border-color: transparent !important;
    color: transparent !important;
    pointer-events: none;
}

.cal-day.no-event {
    cursor: not-allowed;
    opacity: 0.25;
    pointer-events: none;
}

.cal-day.has-event {
    color: var(--text-primary);
    background: rgba(30, 41, 59, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.cal-day.has-event:hover {
    transform: translateY(-2px);
    background: rgba(30, 41, 59, 0.65);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Indicator dots/borders */
.cal-day.day-active {
    border-color: rgba(46, 196, 182, 0.45);
    box-shadow: inset 0 0 4px rgba(46, 196, 182, 0.1);
}

.cal-day.day-active::after {
    content: '';
    position: absolute;
    bottom: 3px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--green);
    box-shadow: 0 0 6px var(--green);
}

.cal-day.day-resolved {
    border-color: rgba(255, 77, 109, 0.45);
    box-shadow: inset 0 0 4px rgba(255, 77, 109, 0.1);
}

.cal-day.day-resolved::after {
    content: '';
    position: absolute;
    bottom: 3px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--red);
    box-shadow: 0 0 6px var(--red);
}

/* Day Selected state */
.cal-day.day-selected {
    background: rgba(0, 240, 255, 0.15) !important;
    border-color: var(--cyan) !important;
    color: var(--text-primary) !important;
    box-shadow: var(--shadow-neon-cyan) !important;
    transform: scale(1.08);
}

/* Legend styling */
.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 6px;
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.legend-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.active-dot {
    background-color: var(--green);
    box-shadow: 0 0 6px var(--green);
}

.resolved-dot {
    background-color: var(--red);
    box-shadow: 0 0 6px var(--red);
}

/* Sidebar event info details */
.sidebar-event-info {
    margin: 10px 16px 20px 16px;
    padding: 14px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-event-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-event-info h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.font-semibold {
    font-weight: 600;
}

/* Topbar Alignment adjustments */
.topbar-left {
    display: flex;
    align-items: center;
}

/* ==============================================================================
   RESPONSIVE DESIGN (MÓVIL Y TABLET)
   ============================================================================== */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 290px;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background-color: rgba(13, 18, 30, 0.98);
        box-shadow: none;
        border-right: 1px solid var(--card-border);
        border-bottom: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.6);
    }

    .sidebar-header {
        padding: 16px 20px;
    }

    .sidebar-close-btn {
        display: flex; /* Mostrar botón de cerrar en móvil */
    }

    .section-title {
        padding: 12px 20px 4px 20px;
    }

    .topbar {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 16px 20px;
        width: 100%;
    }

    .topbar h1 {
        font-size: 18px;
    }

    .system-status {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px;
    }

    .status-badge {
        font-size: 11px;
        padding: 4px 8px;
    }

    .dashboard-grid {
        padding: 16px;
        gap: 20px;
    }

    .metrics-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .metric-card {
        padding: 16px;
        gap: 16px;
    }

    .metric-value {
        font-size: 20px;
    }

    .content-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .content-row-three {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .chart-wrapper {
        height: 260px;
        padding: 12px 0;
    }

    .premium-table th, 
    .premium-table td {
        padding: 12px 16px;
    }

    .panel-header {
        padding: 16px 20px;
    }

    .panel-header h3 {
        font-size: 14px;
    }

    .welcome-screen {
        padding: 60px 20px;
    }

    .welcome-icon {
        font-size: 56px;
        margin-bottom: 16px;
    }

    .welcome-screen h2 {
        font-size: 20px;
    }
}

/* ==============================================================================
   ESTILOS PREMIUM PARA EL MODAL DE IA (GLASSMORPHISM)
   ============================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(8, 11, 19, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: opacity 0.3s ease, visibility 0.3s;
}

.modal-content {
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 240, 255, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalScaleUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalScaleUp {
    from {
        transform: scale(0.94);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.4);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    color: var(--red);
    background: rgba(255, 77, 109, 0.1);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex-grow: 1;
    color: var(--text-primary);
}

/* Estilos de Markdown del modal */
.markdown-content {
    font-size: 14px;
    line-height: 1.6;
}

.markdown-content p {
    margin-bottom: 16px;
}

.markdown-content h1, 
.markdown-content h2, 
.markdown-content h3 {
    color: var(--cyan);
    font-weight: 700;
    margin-top: 24px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(0, 240, 255, 0.15);
    padding-bottom: 6px;
}

.markdown-content h1 { font-size: 18px; }
.markdown-content h2 { font-size: 16px; }
.markdown-content h3 { font-size: 14px; }

.markdown-content ul, 
.markdown-content ol {
    margin-left: 20px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.markdown-content li {
    color: var(--text-secondary);
}

.markdown-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.markdown-content blockquote {
    background: rgba(0, 240, 255, 0.04);
    border-left: 4px solid var(--cyan);
    padding: 12px 16px;
    border-radius: 0 12px 12px 0;
    margin-bottom: 16px;
    font-style: italic;
    color: var(--text-secondary);
}

.markdown-content hr {
    border: none;
    border-bottom: 1px solid var(--card-border);
    margin: 20px 0;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.4);
}

/* Estilo para botón brillante de IA */
.glowing-btn-cyan {
    background: linear-gradient(135deg, #00f0ff, #0077b6) !important;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.35) !important;
    transition: all 0.25s ease !important;
}

.glowing-btn-cyan:hover {
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.65) !important;
    transform: translateY(-1px);
}

.small-btn {
    padding: 8px 14px !important;
    font-size: 12px !important;
    border-radius: 8px !important;
    background: linear-gradient(135deg, #1e293b, #334155) !important;
    box-shadow: none !important;
    border: 1px solid var(--card-border) !important;
}

.small-btn:hover {
    background: linear-gradient(135deg, #334155, #475569) !important;
}

/* Spinner de carga */
.loader-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s ease-in-out infinite;
}

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

/* Textarea de Posiciones del Usuario */
.ai-textarea {
    width: 100%;
    height: 60px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 12px;
    resize: none;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-top: 4px;
}

.ai-textarea:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
}

.mb-3 {
    margin-bottom: 12px !important;
}

.mb-4 {
    margin-bottom: 16px !important;
}

/* Password Login Screen Styles */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 15, 30, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.login-card {
    width: 380px;
    padding: 32px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.login-header h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-primary), var(--cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hidden {
    display: none !important;
}

