:root {
    /* Paleta: principal blanco, secundario rojo */
    --bg:#ffffff; 
    --card:#f8f9fa; 
    --muted:#6c757d; 
    --text:#212529; 
    --accent:#dc3545; 
    --accent-2:#c82333; 
    --danger:#dc3545; 
    --warning:#ffc107; 
    --success:#28a745; 
    --info:#17a2b8;
    --sidebar-width: 250px;
    --sidebar-bg: #2c3e50;
    --sidebar-text: #ecf0f1;
}

/* Asegura que el padding y el borde no desborden el ancho */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body { 
    height:100%; 
    margin:0; 
    padding:0; 
}

body { 
    background:var(--bg); 
    color:var(--text); 
    font-family: 'Inter', system-ui, -apple-system, sans-serif; 
    line-height:1.5; 
}

/* Layout containers */
.page { 
    display:none; 
    min-height:100vh; 
}

.page.active { 
    display:block; 
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
    display: none; /* Oculto por defecto hasta que se autentique */
}

.sidebar.authenticated {
    display: block;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    display: block;
    padding: 12px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background-color 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    border-left-color: var(--accent);
}

.nav-item i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Main content */
.main-content {
    margin-left: 0; /* Sin margen por defecto */
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    display: none; /* Oculto por defecto hasta autenticación */
}

.main-content.with-sidebar {
    margin-left: var(--sidebar-width);
    display: block; /* Mostrar contenido al estar autenticado */
}

/* Header */
.app-header { 
    background:linear-gradient(135deg, #dc3545, #c82333); 
    padding:16px 24px; 
    box-shadow:0 2px 10px rgba(0,0,0,0.1); 
    position:sticky; 
    top:0; 
    z-index:100; 
}

.header-content { 
    display:flex; 
    align-items:center; 
    justify-content:space-between; 
    max-width:1400px; 
    margin:0 auto; 
}

.header-left { 
    display:flex; 
    align-items:center; 
    gap:16px; 
}

.logo-container { 
    display:flex; 
    align-items:center; 
    gap:12px; 
}

.logo-img { 
    width:40px; 
    height:40px; 
    border-radius:8px; 
    object-fit:cover; 
}

.header-title { 
    color:white; 
    margin:0; 
    font-size:20px; 
    font-weight:700; 
}

.header-subtitle { 
    color:rgba(255,255,255,0.8); 
    font-size:14px; 
    margin:0; 
}

.header-actions { 
    display:flex; 
    gap:12px; 
    align-items:center; 
}

/* Navigation */
.nav-tabs { 
    background:white; 
    border-bottom:1px solid #e9ecef; 
    padding:0 24px; 
}

.nav-content { 
    max-width:1400px; 
    margin:0 auto; 
    display:flex; 
    gap:0; 
    position:relative; 
}

.nav-tab { 
    padding:16px 24px; 
    background:none; 
    border:none; 
    color:var(--muted); 
    font-weight:500; 
    cursor:pointer; 
    border-bottom:3px solid transparent; 
    transition:all 0.2s ease; 
}

.nav-tab.active { 
    color:var(--accent); 
    border-bottom-color:var(--accent); 
    background:#f8f9fa; 
}

.nav-tab:hover { 
    color:var(--accent); 
    background:#f8f9fa; 
}

.nav-underline { 
    position:absolute; 
    bottom:0; 
    height:3px; 
    background:linear-gradient(90deg, var(--accent), var(--accent-2)); 
    border-radius:2px; 
    transition: all .25s ease; 
}

/* Buttons */
.btn { 
    background:var(--accent); 
    color:white; 
    border:none; 
    padding:10px 20px; 
    border-radius:8px; 
    cursor:pointer; 
    font-weight:500; 
    font-size:14px; 
    transition:all 0.2s ease; 
    display:inline-block;
    text-decoration:none;
    text-align:center;
    user-select:none;
    -webkit-user-select:none;
    -moz-user-select:none;
    -ms-user-select:none;
}

.btn:hover:not(:disabled) { 
    background:var(--accent-2); 
    transform:translateY(-1px); 
    box-shadow:0 4px 12px rgba(220,53,69,0.3); 
}

.btn:disabled {
    opacity:0.6;
    cursor:not-allowed;
    transform:none !important;
    box-shadow:none !important;
}

.btn.secondary { 
    background:#6c757d; 
    color:white; 
}

.btn.secondary:hover:not(:disabled) { 
    background:#5a6268; 
}

.btn.outline { 
    background:transparent; 
    color:var(--accent); 
    border:1px solid var(--accent); 
}

.btn.outline:hover:not(:disabled) { 
    background:var(--accent); 
    color:white; 
}

.btn.small { 
    padding:6px 12px; 
    font-size:12px; 
}

.btn:focus-visible { 
    outline:3px solid rgba(220,53,69,0.35); 
    outline-offset:2px; 
}

/* Better contrast for header buttons over red gradient */
.app-header .btn { 
    background:rgba(255,255,255,0.12); 
    color:#fff; 
    border:1px solid rgba(255,255,255,0.35); 
    backdrop-filter:blur(10px);
    -webkit-backdrop-filter:blur(10px);
}

.app-header .btn:hover:not(:disabled) { 
    background:rgba(255,255,255,0.22); 
    box-shadow:0 6px 18px rgba(0,0,0,0.25); 
    transform:translateY(-1px); 
}

.app-header .btn:disabled {
    opacity:0.5;
    cursor:not-allowed;
    transform:none !important;
    box-shadow:none !important;
}

.app-header .btn.outline { 
    background:transparent; 
    color:#fff; 
    border:1px solid rgba(255,255,255,0.6); 
}

.app-header .btn.outline:hover:not(:disabled) { 
    background:rgba(255,255,255,0.18); 
}

/* Auth */
.login-wrap { 
    min-height:100vh; 
    display:grid; 
    place-items:center; 
    padding:24px; 
    background:linear-gradient(135deg, #f8f9fa, #e9ecef); 
    overflow: hidden; /* evita barra blanca por sombra/overflow */
}

.login-card { 
    width:100%; 
    max-width:480px; 
    background:white; 
    padding:28px 28px; 
    border-radius:16px; 
    box-shadow:0 20px 50px rgba(0,0,0,0.1); 
    margin: 0 auto; /* asegura centrado horizontal y separa del borde derecho */
}

.login-logo { 
    display:flex; 
    align-items:center; 
    gap:12px; 
    margin-bottom:24px; 
    width:100%;
}

.login-logo-img { 
    width:48px; 
    height:48px; 
    border-radius:12px; 
    object-fit:cover; 
}

.login-title { 
    font-size:28px; 
    font-weight:700; 
    margin:0; 
    color:var(--text); 
}

.login-subtitle { 
    color:var(--muted); 
    font-size:14px; 
    margin:4px 0 0 0; 
}

.field { 
    margin:16px 0; 
}

.field label { 
    display:block; 
    font-size:14px; 
    font-weight:500; 
    color:var(--text); 
    margin-bottom:6px; 
}

.field input { 
    width:100%; 
    padding:12px 16px; 
    border:1px solid #dee2e6; 
    border-radius:8px; 
    font-size:14px; 
    transition:border-color 0.2s ease; 
}

/* inputs más cortos visualmente dentro del card */
.login-card .field input {
    max-width: 640px;
}

.field input:focus { 
    outline:none; 
    border-color:var(--accent); 
    box-shadow:0 0 0 3px rgba(220,53,69,0.1); 
}

.error { 
    color:var(--danger); 
    font-size:13px; 
    margin-top:4px; 
}

/* Dashboard */
.container { 
    padding:24px; 
    max-width:1400px; 
    margin:0 auto; 
}

.section-title { 
    font-size:18px; 
    font-weight:600; 
    color:var(--text); 
    margin:0 0 16px 0; 
    display:flex; 
    align-items:center; 
    gap:8px; 
}

.section-title::before { 
    content:''; 
    width:4px; 
    height:20px; 
    background:var(--accent); 
    border-radius:2px; 
}

/* KPI Cards */
.kpi-grid { 
    display:grid; 
    grid-template-columns:repeat(auto-fit, minmax(250px, 1fr)); 
    gap:20px; 
    margin-bottom:32px; 
}

.kpi-card { 
    background:white; 
    padding:24px; 
    border-radius:12px; 
    box-shadow:0 2px 8px rgba(0,0,0,0.08); 
    border:1px solid #e9ecef; 
    transition:all 0.2s ease; 
}

.kpi-card:hover { 
    transform:translateY(-2px); 
    box-shadow:0 8px 25px rgba(0,0,0,0.12); 
}

.kpi-header { 
    display:flex; 
    align-items:center; 
    justify-content:space-between; 
    margin-bottom:12px; 
}

.kpi-title { 
    font-size:14px; 
    font-weight:500; 
    color:var(--muted); 
    margin:0; 
}

.kpi-icon { 
    width:24px; 
    height:24px; 
    opacity:0.7; 
}

.kpi-value { 
    font-size:32px; 
    font-weight:700; 
    color:var(--text); 
    margin:0 0 8px 0; 
}

.kpi-change { 
    font-size:12px; 
    padding:4px 8px; 
    border-radius:12px; 
    font-weight:500; 
}

.kpi-change.positive { 
    background:#d4edda; 
    color:#155724; 
}

.kpi-change.negative { 
    background:#f8d7da; 
    color:#721c24; 
}

.kpi-change.neutral { 
    background:#e2e3e5; 
    color:#6c757d; 
}

/* Sentiment Cards */
.sentiment-grid { 
    display:grid; 
    grid-template-columns:repeat(auto-fit, minmax(200px, 1fr)); 
    gap:20px; 
    margin-bottom:32px; 
}

.sentiment-card { 
    background:white; 
    padding:20px; 
    border-radius:12px; 
    box-shadow:0 2px 8px rgba(0,0,0,0.08); 
    border:1px solid #e9ecef; 
    text-align:center; 
    transition:all 0.2s ease; 
}

.sentiment-card:hover { 
    transform:translateY(-2px); 
    box-shadow:0 8px 25px rgba(0,0,0,0.12); 
}

.sentiment-icon { 
    width:32px; 
    height:32px; 
    margin:0 auto 12px; 
}

.sentiment-value { 
    font-size:28px; 
    font-weight:700; 
    margin:0 0 8px 0; 
}

.sentiment-label { 
    font-size:14px; 
    font-weight:500; 
    color:var(--muted); 
    margin:0 0 4px 0; 
}

.sentiment-desc { 
    font-size:12px; 
    color:var(--muted); 
    margin:0; 
}

/* Charts */
.charts-grid { 
    display:grid; 
    grid-template-columns:repeat(auto-fit, minmax(400px, 1fr)); 
    gap:24px; 
    margin-bottom:32px; 
}

.chart-card { 
    background: white; 
    padding: 24px; 
    border-radius: 12px; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.08); 
    border: 1px solid #e9ecef; 
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.chart-title { 
    font-size: 16px; 
    font-weight: 600; 
    color: var(--text); 
    margin: 0 0 16px 0; 
    text-align: center;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    padding: 0 8px;
}

/* Canvas de gráficos de distribución */
.chart-card canvas {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
    flex: 1;
}

/* Análisis de Intenciones */
.intentions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.intention-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
    display: flex;            /* Permite que la lista aproveche todo el alto */
    flex-direction: column;
}

.intention-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.intention-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.intention-icon {
    font-size: 20px;
}

.intention-list {
    flex: 1;                  /* Ocupar todo el espacio disponible del card */
    max-height: none;         /* Quitar límite fijo */
    overflow-y: auto;
    padding: 0;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

.intention-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    border-bottom: none;
    width: 100%;
    box-sizing: border-box;
    min-height: 60px;
}

.intention-item:hover {
    transform: translateX(4px);
}

.intention-item:last-child {
    margin-bottom: 0;
}

.intention-item:last-child {
    border-bottom: none;
}

/* Asegurar que el contenedor padre tenga el ancho correcto */
.intention-card {
    width: 100%;
    overflow: visible; /* evitar que se corten los índices o el canvas */
}

.intention-card .intention-list {
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

.intention-name {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
}

.intention-count {
    background: var(--accent);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.intention-percentage {
    font-size: 12px;
    color: var(--muted);
    margin-left: 8px;
}

/* Container de tendencias */
.trends-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: auto;
}

.trends-chart {
    flex: 1;
    position: relative;
    order: 1;
    width: 100%;
}

.trends-indices {
    flex: none;
    display: grid;                          /* 3 columnas fluidas */
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    padding: 10px 0;
    order: 2;
    gap: 16px;
}

/* Alineación específica por columna */
.trends-indices .trend-index-item:nth-child(1),
.trends-indices .trend-index-item:nth-child(2),
.trends-indices .trend-index-item:nth-child(3) { justify-self: center; text-align: center; }

.trend-index-item {
    display: flex;
    align-items: center;
    justify-content: center; /* centrar contenido */
    padding: 10px 14px;
    background: rgba(0,0,0,0.02);
    border-radius: 10px;
    width: 100%;
    gap: 10px;
}

.trend-index-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    margin-right: 12px;
}

.trend-index-info {
    flex: 1;
    text-align: center; /* centrar textos */
}

.trend-index-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.trend-index-value {
    font-size: 11px;
    color: var(--muted);
}

/* El canvas del gráfico debe usar todo el ancho disponible */
.trends-chart canvas {
    width: 100% !important;
    height: 360px !important;
    display: block;
}

/* Responsivo: si el ancho no alcanza, pasar a 2 y 1 columna */
@media (max-width: 1100px) {
    .trends-indices {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 720px) {
    .trends-indices {
        grid-template-columns: 1fr;
    }
    .trends-indices .trend-index-item:nth-child(1),
    .trends-indices .trend-index-item:nth-child(2),
    .trends-indices .trend-index-item:nth-child(3) {
        justify-self: stretch;
        text-align: left;
    }
}

/* Indicador de sincronización */
.sync-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.3);
    border-radius: 6px;
    font-size: 12px;
    color: var(--success);
}

.sync-text {
    font-weight: 500;
}

.sync-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(40, 167, 69, 0.3);
    border-top: 2px solid var(--success);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Intenciones Detectadas - Formato de Lista */
.intention-detected-list {
    flex: 1;
    max-height: none;
    overflow: hidden;
    padding: 0;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

.intention-detected-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    border-left: 4px solid transparent;
    width: 100%;
    box-sizing: border-box;
    min-height: 60px;
    background: rgba(0,0,0,0.02);
}

.intention-detected-item:hover {
    background: rgba(0,0,0,0.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.intention-detected-item:last-child {
    margin-bottom: 0;
}

/* Colores específicos para cada intención */
.intention-detected-item[data-intention="contacto"] {
    border-left-color: #28a745;
}

.intention-detected-item[data-intention="testdrive"] {
    border-left-color: #fd7e14;
}

.intention-detected-item[data-intention="informacion"] {
    border-left-color: #17a2b8;
}

.intention-detected-item[data-intention="cotizacion"] {
    border-left-color: #28a745;
}

.intention-detected-item[data-intention="financiamiento"] {
    border-left-color: #6f42c1;
}

.intention-detected-item[data-intention="soporte"] {
    border-left-color: #fd7e14;
}

.intention-detected-item[data-intention="reclamo"] {
    border-left-color: #dc3545;
}

.intention-detected-icon {
    font-size: 20px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.intention-detected-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.intention-detected-title {
    font-size: 14px;
    color: var(--text);
    font-weight: 600;
    margin: 0;
}

.intention-detected-metrics {
    font-size: 12px;
    color: var(--muted);
    margin: 0;
}

.intention-detected-count {
    font-size: 24px;
    font-weight: 700;
    margin-right: 8px;
    flex-shrink: 0;
}

.intention-detected-percentage {
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Colores específicos para números y porcentajes */
.intention-detected-item[data-intention="contacto"] .intention-detected-count,
.intention-detected-item[data-intention="contacto"] .intention-detected-percentage {
    color: #28a745;
}

.intention-detected-item[data-intention="testdrive"] .intention-detected-count,
.intention-detected-item[data-intention="testdrive"] .intention-detected-percentage {
    color: #fd7e14;
}

.intention-detected-item[data-intention="informacion"] .intention-detected-count,
.intention-detected-item[data-intention="informacion"] .intention-detected-percentage {
    color: #17a2b8;
}

.intention-detected-item[data-intention="cotizacion"] .intention-detected-count,
.intention-detected-item[data-intention="cotizacion"] .intention-detected-percentage {
    color: #28a745;
}

.intention-detected-item[data-intention="financiamiento"] .intention-detected-count,
.intention-detected-item[data-intention="financiamiento"] .intention-detected-percentage {
    color: #6f42c1;
}

.intention-detected-item[data-intention="soporte"] .intention-detected-count,
.intention-detected-item[data-intention="soporte"] .intention-detected-percentage {
    color: #fd7e14;
}

.intention-detected-item[data-intention="reclamo"] .intention-detected-count,
.intention-detected-item[data-intention="reclamo"] .intention-detected-percentage {
    color: #dc3545;
}

/* Modal de detalles de intención */
.intention-details-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.intention-details-modal.show {
    display: flex;
}

.intention-details-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
}

.intention-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.intention-details-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--accent);
    margin: 0;
}

.intention-details-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 4px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.intention-details-close:hover {
    background: #f5f5f5;
    color: #333;
}

.intention-details-info {
    display: grid;
    gap: 20px;
}

.intention-detail-section {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid var(--accent);
}

.intention-detail-section h4 {
    margin: 0 0 12px 0;
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
}

.intention-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.intention-keyword {
    background: var(--accent);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.intention-messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.intention-message {
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    font-size: 14px;
    color: var(--text);
}

/* Palabras Clave */
.keywords-container {
    margin-bottom: 30px;
}

.keywords-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
}

.keywords-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.keywords-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.keywords-icon {
    font-size: 20px;
}

.keywords-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    padding: 20px;
    background: rgba(0,0,0,0.02);
    border-radius: 8px;
}

.keyword-tag {
    display: inline-block;
    padding: 6px 12px;
    background: var(--accent);
    color: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    margin: 2px;
    transition: all 0.2s ease;
}

.keyword-tag:hover {
    background: var(--accent-2);
    transform: scale(1.05);
}

.keyword-tag.size-small {
    font-size: 11px;
    padding: 4px 8px;
}

.keyword-tag.size-medium {
    font-size: 13px;
    padding: 6px 12px;
}

.keyword-tag.size-large {
    font-size: 15px;
    padding: 8px 16px;
}

.keyword-tag.size-extra-large {
    font-size: 17px;
    padding: 10px 20px;
}

/* Contact Form */
.contact-form {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
    margin-bottom: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 16px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(220,53,69,0.1);
}

/* Contact List */
.contact-list {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
    overflow: hidden;
}

.contact-item {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.contact-item:hover {
    background: #f8f9fa;
}

.contact-item:last-child {
    border-bottom: none;
}

.contact-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.contact-name {
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.contact-id {
    font-size: 12px;
    color: var(--muted);
    background: #f8f9fa;
    padding: 2px 8px;
    border-radius: 4px;
}

.contact-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    font-size: 14px;
    color: var(--muted);
}

/* Tilt microinteraction */
.tilt { 
    will-change: transform; 
    transform-style: preserve-3d; 
    transition: transform .12s ease, box-shadow .2s ease; 
}

.tilt:hover { 
    box-shadow:0 12px 30px rgba(0,0,0,0.15); 
}

/* Skeleton loading */
.skeleton { 
    position:relative; 
    overflow:hidden; 
    background:#eef1f3; 
    border-radius:12px; 
    min-height:220px; 
}

.skeleton::after { 
    content:''; 
    position:absolute; 
    inset:0; 
    background:linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.6), rgba(255,255,255,0)); 
    transform:translateX(-100%); 
    animation: shimmer 1.2s infinite; 
}

@keyframes shimmer { 
    100% { 
        transform:translateX(100%); 
    } 
}

/* Filters */
.filters-bar { 
    background:white; 
    padding:20px 24px; 
    border-radius:12px; 
    box-shadow:0 2px 8px rgba(0,0,0,0.08); 
    border:1px solid #e9ecef; 
    margin-bottom:24px; 
}

.filters-grid { 
    display:grid; 
    grid-template-columns:repeat(auto-fit, minmax(200px, 1fr)); 
    gap:16px; 
    align-items:end; 
}

.filter-group { 
    display:flex; 
    flex-direction:column; 
    gap:6px; 
}

.filter-label { 
    font-size:12px; 
    font-weight:500; 
    color:var(--muted); 
}

.filter-input { 
    padding:10px 12px; 
    border:1px solid #dee2e6; 
    border-radius:6px; 
    font-size:14px; 
}

.filter-input:focus { 
    outline:none; 
    border-color:var(--accent); 
}

/* Table */
.table-container { 
    background:white; 
    border-radius:12px; 
    box-shadow:0 2px 8px rgba(0,0,0,0.08); 
    border:1px solid #e9ecef; 
    overflow:hidden; 
}

.table { 
    width:100%; 
    border-collapse:collapse; 
}

.table th { 
    background:#f8f9fa; 
    padding:16px; 
    text-align:left; 
    font-weight:600; 
    color:var(--text); 
    border-bottom:1px solid #e9ecef; 
}

.table td { 
    padding:16px; 
    border-bottom:1px solid #f1f3f4; 
}

.table tr:hover { 
    background:#f8f9fa; 
}

.table tr:last-child td { 
    border-bottom:none; 
}

/* Pagination */
.pagination { 
    display:flex; 
    align-items:center; 
    justify-content:space-between; 
    padding:16px 24px; 
    background:white; 
    border-top:1px solid #e9ecef; 
}

.pagination-info { 
    color:var(--muted); 
    font-size:14px; 
}

.pagination-controls { 
    display:flex; 
    gap:8px; 
    align-items:center; 
}

/* Chat View */
.chat-container { 
    background:white; 
    border-radius:12px; 
    box-shadow:0 2px 8px rgba(0,0,0,0.08); 
    border:1px solid #e9ecef; 
    height:500px; 
    display:flex; 
    flex-direction:column; 
    transform: translateY(12px) scale(.98); 
    opacity:0; 
    transition: transform .22s ease, opacity .22s ease; 
}

.chat-header { 
    padding:16px 20px; 
    border-bottom:1px solid #e9ecef; 
    background:#f8f9fa; 
    display:flex; 
    align-items:center; 
    justify-content:space-between;
    border-radius: 12px 12px 0 0;
}

.chat-title { 
    font-weight:600; 
    color:var(--text); 
    margin:0; 
    font-size: 16px;
}

.chat-close { 
    background:none; 
    border:none; 
    color:var(--muted); 
    cursor:pointer; 
    font-size:20px; 
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.chat-close:hover {
    background: rgba(0,0,0,0.1);
}

.chat-messages { 
    flex:1; 
    padding:20px; 
    overflow-y:auto; 
    display:flex; 
    flex-direction:column; 
    gap:12px;
    background: #fafbfc;
}

/* Asegurar que las burbujas ocupen todo el ancho disponible dentro del modal */
.chat-messages .message { width: 100%; gap: 8px; display: flex; }
.chat-messages .message > div { flex: 0 0 auto; max-width: 100%; }
/* usar ancho natural de la burbuja */
.chat-messages .message-content { max-width: 70% !important; }

/* Forzar alineación en el modal de Intenciones */
.chat-messages .message.user { justify-content: flex-end !important; flex-direction: row-reverse !important; }
.chat-messages .message.bot { justify-content: flex-start !important; flex-direction: row !important; }
.chat-messages .message.user .message-content { margin-left: auto !important; }
.chat-messages .message.bot .message-content { margin-right: auto !important; }

/* En el modal de Intenciones: pegar realmente a los bordes */
.chat-messages .message.user .message-avatar { display: flex; }
.chat-messages .message.user { padding-right: 0; }
.chat-messages .message.bot { padding-left: 0; }
.chat-messages .message-content { max-width: 85% !important; }

/* WhatsApp-like layout for Intenciones modal only */
.wa-thread { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.wa-row { display: flex; width: 100%; }
.wa-row.user { justify-content: flex-end; }
.wa-row.bot { justify-content: flex-start; }
.wa-avatar { width: 32px; height: 32px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; margin: 0 8px; flex: 0 0 32px; }
.wa-body { max-width: calc(100% - 48px); display: flex; flex-direction: column; }
.wa-bubble { border-radius: 18px; padding: 10px 12px; max-width: 72%; line-height: 1.4; word-break: break-word; }
.wa-row.user .wa-bubble { border-bottom-right-radius: 6px; }
.wa-row.bot .wa-bubble { border-bottom-left-radius: 6px; background: #f1f3f5; color: var(--text); border: 1px solid #e9ecef; }
.wa-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.wa-row.user .wa-meta { text-align: right; }
.wa-row.bot .wa-meta { text-align: left; }

.message { 
    display: flex; 
    gap: 8px; 
    align-items: flex-end;
    margin-bottom: 8px;
    width: 100%;
}

.message.user { 
    justify-content: flex-end !important;
    flex-direction: row-reverse !important; /* burbuja y avatar a la derecha */
    margin-right: 0 !important; /* Eliminar cualquier margen derecho */
}

.message.bot { 
    justify-content: flex-start !important; /* Agente a la izquierda */
    margin-left: 0 !important; /* Eliminar cualquier margen izquierdo */
}

.message-avatar { 
    width:36px; 
    height:36px; 
    border-radius:50%; 
    color:white; 
    display:flex; 
    align-items:center; 
    justify-content:center; 
    font-size:16px; 
    font-weight:600;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.message-content { 
    max-width: 70%; 
    padding: 8px 12px; 
    border-radius: 18px; 
    font-size: 14px; 
    line-height: 1.4; 
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    position: relative;
}

/* Reglas específicas para el contenido de mensajes del usuario */
.message.user .message-content {
    max-width: 70% !important;
    margin-left: auto !important;
    margin-right: 0 !important;
}

/* Reglas específicas para el contenido de mensajes del bot */
.message.bot .message-content {
    max-width: 70% !important;
    margin-left: 0 !important;
    margin-right: auto !important;
}

.message.bot .message-content { 
    background: #f8f9fa; 
    color: var(--text); 
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px; /* Esquina puntiaguda como WhatsApp */
}

.message.user .message-content { 
    /* color se ajusta dinámicamente desde inline style para cada intención */
    border-bottom-right-radius: 4px; /* Esquina puntiaguda como WhatsApp */
    margin-right: 0; /* Eliminar margen derecho */
}

/* Asegurar que los mensajes del cliente queden pegados al extremo derecho */
.message.user {
    padding-right: 0 !important;
    margin-right: 0 !important;
}

.message.user .message-avatar {
    margin-right: 0 !important;
    margin-left: 8px !important; /* Espacio entre avatar y mensaje cuando está a la derecha */
}

.message.user .message-content {
    margin-right: 0 !important;
    padding-right: 12px !important; /* Padding interno para que el texto no toque el borde */
    padding-left: 12px !important;
}

.message-time { 
    font-size:11px; 
    color:var(--muted); 
    margin-top:4px; 
}

/* Mejoras para el modal del chat */
#chat-modal {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

#chat-modal.show .chat-container {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Estilo WhatsApp para el chat con colores de la página */
.chat-messages {
    background: #f8f9fa; /* Fondo claro de la página */
    padding: 20px; /* Padding uniforme en todos los lados */
    box-sizing: border-box;
}


/* Mejorar el contenedor del chat */
.chat-container {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Reglas específicas para forzar la alineación correcta */
.message.user {
    display: flex !important;
    justify-content: flex-end !important;
    flex-direction: row-reverse !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    align-items: flex-end !important;
}

.message.bot {
    display: flex !important;
    justify-content: flex-start !important;
    flex-direction: row !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    align-items: flex-end !important;
}

/* Forzar que el contenido del mensaje del usuario se alinee a la derecha */
.message.user .message-content {
    margin-left: auto !important;
    margin-right: 0 !important;
    flex-shrink: 0 !important;
}

/* Forzar que el contenido del mensaje del bot se alinee a la izquierda */
.message.bot .message-content {
    margin-left: 0 !important;
    margin-right: auto !important;
    flex-shrink: 0 !important;
}

/* Estilo para mensajes consecutivos del mismo usuario */
.message.user + .message.user .message-avatar,
.message.bot + .message.bot .message-avatar {
    opacity: 0;
}

.message.user + .message.user .message-content,
.message.bot + .message.bot .message-content {
    margin-top: 2px;
}

/* Floating button */
.fab { 
    position:fixed; 
    bottom:24px; 
    right:24px; 
    width:56px; 
    height:56px; 
    border-radius:50%; 
    background:var(--accent); 
    color:white; 
    border:none; 
    cursor:pointer; 
    box-shadow:0 4px 16px rgba(220,53,69,0.3); 
    display:flex; 
    align-items:center; 
    justify-content:center; 
    font-size:20px; 
    transition:all 0.2s ease; 
    z-index:50; 
}

.fab:hover { 
    background:var(--accent-2); 
    transform:scale(1.05); 
}

/* Chat modal overlay animation */
#chat-modal { 
    opacity:0; 
    pointer-events:none; 
    display:none; 
    align-items:center; 
    justify-content:center; 
    transition: opacity .2s ease; 
}

#chat-modal.show { 
    opacity:1; 
    pointer-events:auto; 
    display:flex !important;
}

#chat-modal.show .chat-container { 
    transform: translateY(0) scale(1); 
    opacity:1; 
}

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
}

@media (prefers-reduced-motion: reduce) {
    .tilt, .chat-container, #chat-modal { 
        transition: none !important; 
    }
}

/* Google Calendar Style - Complete Redesign */
.gcal-container {
    display: flex;
    height: calc(100vh - 120px);
    background: #fff;
    overflow: hidden;
}

/* Left Sidebar - Google Calendar Style */
.gcal-sidebar {
    width: 300px;
    background: #fff;
    border-right: 1px solid #dadce0;
    padding: 16px;
    overflow-y: auto;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

/* Create Button */
.gcal-create-btn {
    width: 100%;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 24px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.gcal-create-btn:hover {
    background: #1557b0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.gcal-plus-icon {
    font-size: 18px;
    font-weight: 300;
}

/* Mini Calendar */
.gcal-mini-calendar {
    margin-bottom: 24px;
}

.gcal-mini-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.gcal-mini-header h3 {
    font-size: 16px;
    font-weight: 400;
    color: #3c4043;
    margin: 0;
}

.gcal-nav-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #5f6368;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gcal-nav-btn:hover {
    background-color: #f1f3f4;
}

.gcal-mini-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #dadce0;
    border: 1px solid #dadce0;
    border-radius: 8px;
    overflow: hidden;
}

.gcal-mini-day-header {
    background: #f8f9fa;
    padding: 8px 4px;
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    color: #5f6368;
}

.gcal-mini-day {
    background: #fff;
    padding: 8px 4px;
    text-align: center;
    font-size: 13px;
    color: #3c4043;
    cursor: pointer;
    transition: background-color 0.2s;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gcal-mini-day:hover {
    background-color: #f1f3f4;
}

.gcal-mini-day.selected {
    background-color: #1a73e8;
    color: white;
    border-radius: 50%;
}

.gcal-mini-day.other-month {
    color: #dadce0;
}

.gcal-mini-day.today {
    background-color: #1a73e8;
    color: white;
    border-radius: 50%;
    font-weight: 500;
}

/* Calendars Section */
.gcal-calendars-section {
    margin-bottom: 24px;
}

.gcal-section-title {
    font-size: 14px;
    font-weight: 500;
    color: #3c4043;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gcal-calendar-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gcal-calendar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.gcal-calendar-item:hover {
    background-color: #f8f9fa;
}

.gcal-calendar-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.gcal-calendar-name {
    flex: 1;
    font-size: 14px;
    color: #3c4043;
}

.gcal-calendar-toggle {
    position: relative;
}

.gcal-calendar-toggle input[type="checkbox"] {
    opacity: 0;
    position: absolute;
}

.gcal-calendar-toggle label {
    display: block;
    width: 18px;
    height: 18px;
    border: 2px solid #dadce0;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.gcal-calendar-toggle input[type="checkbox"]:checked + label {
    background: #1a73e8;
    border-color: #1a73e8;
}

.gcal-calendar-toggle input[type="checkbox"]:checked + label::after {
    content: '✓';
    color: white;
    font-size: 12px;
    position: absolute;
    top: -2px;
    left: 2px;
}

/* Main Calendar Area */
.gcal-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
}

/* Calendar Header */
.gcal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #dadce0;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.gcal-header-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.gcal-header-left h1 {
    font-size: 22px;
    font-weight: 400;
    color: #3c4043;
    margin: 0;
}

.gcal-view-tabs {
    display: flex;
    background: #f8f9fa;
    border-radius: 4px;
    padding: 2px;
}

.gcal-view-tab {
    background: none;
    border: none;
    padding: 8px 16px;
    font-size: 14px;
    color: #5f6368;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s;
}

.gcal-view-tab.active {
    background: #fff;
    color: #1a73e8;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.gcal-view-tab:hover:not(.active) {
    background: rgba(255,255,255,0.5);
}

.gcal-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.gcal-search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.gcal-search-input {
    width: 280px;
    padding: 8px 12px 8px 40px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 14px;
    background: #f8f9fa;
    transition: all 0.2s;
}

.gcal-search-input:focus {
    outline: none;
    background: #fff;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26,115,232,0.2);
}

.gcal-search-icon {
    position: absolute;
    left: 12px;
    color: #5f6368;
    font-size: 16px;
}

.gcal-settings-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #5f6368;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.gcal-settings-btn:hover {
    background-color: #f1f3f4;
}

/* Calendar Grid Container */
.gcal-grid-container {
    flex: 1;
    display: flex;
    position: relative;
    overflow-y: auto;
    background: #fff;
}

/* Time Column */
.gcal-time-column {
    width: 60px;
    background: #fff;
    border-right: 1px solid #dadce0;
    position: sticky;
    left: 0;
    z-index: 5;
}

.gcal-timezone {
    height: 40px;
    padding: 8px;
    font-size: 11px;
    color: #5f6368;
    text-align: center;
    border-bottom: 1px solid #dadce0;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gcal-time-slots {
    position: relative;
}

.gcal-time-slot {
    height: 60px;
    padding: 8px;
    font-size: 12px;
    color: #5f6368;
    text-align: center;
    border-bottom: 1px solid #dadce0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

/* Days Container */
.gcal-days-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Days Header */
.gcal-days-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #fff;
    border-bottom: 1px solid #dadce0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.gcal-day-header {
    padding: 12px 8px;
    text-align: center;
    border-right: 1px solid #dadce0;
    background: #f8f9fa;
}

.gcal-day-header:last-child {
    border-right: none;
}

.gcal-day-name {
    font-size: 11px;
    font-weight: 500;
    color: #5f6368;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.gcal-day-number {
    font-size: 16px;
    font-weight: 400;
    color: #3c4043;
}

.gcal-day-header.today .gcal-day-number {
    background: #1a73e8;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Days Grid */
.gcal-days-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    position: relative;
    background-image: 
        linear-gradient(to right, #dadce0 1px, transparent 1px),
        linear-gradient(to bottom, #dadce0 1px, transparent 1px);
    background-size: calc(100% / 7) 60px;
}

.gcal-day-column {
    border-right: 1px solid #dadce0;
    position: relative;
}

.gcal-day-column:last-child {
    border-right: none;
}

.gcal-day-slots {
    position: relative;
    height: 100%;
}

.gcal-time-slot {
    height: 60px;
    border-bottom: 1px solid #dadce0;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s;
}

.gcal-time-slot:hover {
    background-color: #f8f9fa;
}

/* Calendar Events - Google Calendar Style */
.gcal-event {
    position: absolute;
    left: 1px;
    right: 1px;
    background: #1a73e8;
    color: white;
    border-radius: 3px;
    padding: 3px 6px;
    font-size: 11px;
    font-weight: 400;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    transition: all 0.2s;
    border-left: 3px solid #1a73e8;
    line-height: 1.3;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 20px;
}

.gcal-event:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 10;
    transform: scale(1.01);
}

.gcal-event.test-drive {
    background: #1a73e8;
    border-left-color: #1a73e8;
}

.gcal-event.meeting {
    background: #34a853;
    border-left-color: #34a853;
}

.gcal-event.other {
    background: #ea4335;
    border-left-color: #ea4335;
}

.gcal-event.purple {
    background: #9c27b0;
    border-left-color: #9c27b0;
}

/* Current Time Line */
.gcal-current-time {
    position: absolute;
    left: 60px;
    right: 0;
    height: 2px;
    background: #ea4335;
    z-index: 20;
    pointer-events: none;
}

.gcal-current-time::before {
    content: '';
    position: absolute;
    left: -6px;
    top: -4px;
    width: 10px;
    height: 10px;
    background: #ea4335;
    border-radius: 50%;
}

/* Modal de detalles del evento */
.event-details-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.event-details-modal.show {
    display: flex;
}

.event-details-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
}

.event-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.event-details-title {
    font-size: 24px;
    font-weight: 600;
    color: #1a73e8;
    margin: 0;
}

.event-details-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 4px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.event-details-close:hover {
    background: #f5f5f5;
    color: #333;
}

.event-details-info {
    display: grid;
    gap: 16px;
}

.event-detail-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.event-detail-icon {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    color: #666;
}

.event-detail-content {
    flex: 1;
}

.event-detail-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    font-weight: 500;
    margin-bottom: 4px;
}

.event-detail-value {
    font-size: 16px;
    color: #333;
    line-height: 1.4;
    word-break: break-word;
    white-space: normal;
}

.event-detail-value.description {
    white-space: pre-wrap;
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #1a73e8;
}

.current-time-line::before {
    content: '';
    position: absolute;
    left: -6px;
    top: -4px;
    width: 10px;
    height: 10px;
    background: #ea4335;
    border-radius: 50%;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .container { 
        padding:16px; 
    }
    
    .header-content { 
        flex-direction:column; 
        gap:12px; 
        align-items:flex-start; 
    }
    
    .header-actions { 
        width:100%; 
        justify-content:flex-end; 
    }
    
    .nav-content { 
        padding:0 16px; 
    }
    
    .nav-tab { 
        padding:12px 16px; 
        font-size:14px; 
    }
    
    .kpi-grid { 
        grid-template-columns:1fr; 
    }
    
    .sentiment-grid { 
        grid-template-columns:repeat(2, 1fr); 
    }
    
    .charts-grid { 
        grid-template-columns:1fr; 
    }

    .intentions-grid {
        grid-template-columns: 1fr;
    }
    
    .trends-container {
        flex-direction: column;
        height: auto;
    }
    
    .trends-indices {
        flex: none;
        margin-bottom: 20px;
    }

    /* Mejoras para los gráficos de torta */
    .chart-card {
        background: white;
        border-radius: 12px;
        padding: 20px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        border: 1px solid #e9ecef;
    }

    .chart-card canvas {
        display: block;
        margin: 0 auto;
        max-width: 100%;
        height: auto;
    }

    .chart-title {
        font-size: 18px;
        font-weight: 600;
        color: #333;
        margin-bottom: 20px;
        text-align: center;
    }
    
    .filters-grid { 
        grid-template-columns:1fr; 
    }
    
    .table-container { 
        overflow-x:auto; 
    }
    
    .pagination { 
        flex-direction:column; 
        gap:12px; 
        align-items:center; 
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }

/* Responsive Google Calendar */
@media (max-width: 768px) {
    .gcal-container {
        flex-direction: column;
        height: calc(100vh - 80px);
    }
    
    .gcal-sidebar {
        width: 100%;
        height: auto;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid #dadce0;
        padding: 12px;
    }
    
    .gcal-create-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .gcal-mini-calendar {
        margin-bottom: 16px;
    }
    
    .gcal-mini-header h3 {
        font-size: 14px;
    }
    
    .gcal-calendars-section {
        margin-bottom: 16px;
    }
    
    .gcal-main {
        flex: 1;
        overflow: hidden;
    }
    
    .gcal-header {
        padding: 12px 16px;
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .gcal-header-left {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .gcal-header-left h1 {
        font-size: 18px;
    }
    
    .gcal-view-tabs {
        width: 100%;
        justify-content: center;
    }
    
    .gcal-header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .gcal-search-input {
        width: 200px;
    }
    
    .gcal-time-column {
        width: 50px;
    }
    
    .gcal-time-slot {
        height: 50px;
        font-size: 10px;
    }
    
    .gcal-day-header {
        padding: 8px 4px;
    }
    
    .gcal-day-name {
        font-size: 10px;
    }
    
    .gcal-day-number {
        font-size: 14px;
    }
    
    .gcal-event {
        font-size: 10px;
        padding: 1px 4px;
    }
}

@media (max-width: 480px) {
    .gcal-sidebar {
        max-height: 150px;
        padding: 8px;
    }
    
    .gcal-create-btn {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .gcal-mini-grid {
        gap: 0;
    }
    
    .gcal-mini-day {
        min-height: 24px;
        font-size: 11px;
    }
    
    .gcal-calendar-item {
        padding: 4px;
        gap: 8px;
    }
    
    .gcal-calendar-name {
        font-size: 12px;
    }
    
    .gcal-header {
        padding: 8px 12px;
    }
    
    .gcal-header-left h1 {
        font-size: 16px;
    }
    
    .gcal-view-tab {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .gcal-search-input {
        width: 150px;
        font-size: 12px;
    }
    
    .gcal-time-column {
        width: 40px;
    }
    
    .gcal-time-slot {
        height: 40px;
        font-size: 9px;
    }
    
    .gcal-day-header {
        padding: 6px 2px;
    }
    
    .gcal-day-name {
        font-size: 9px;
    }
    
    .gcal-day-number {
        font-size: 12px;
    }
    
    .gcal-event {
        font-size: 9px;
        padding: 1px 2px;
    }
}
}

@media (max-width: 480px) {
    .sentiment-grid { 
        grid-template-columns:1fr; 
    }
    
    .login-card { 
        padding:24px; 
    }
}
