/* Scrollbars más gruesas y fáciles de pulsar */
* {
    scrollbar-width: thick;
    scrollbar-color: #c0c8d8 #f1f4f8;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: #f1f4f8; border-radius: 8px; }
*::-webkit-scrollbar-thumb { background: #c0c8d8; border-radius: 8px; border: 2px solid #f1f4f8; }
*::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

:root {
    /* Color Palette - Light Mode Premium */
    --bg-main: #F8FAFC;
    --bg-sidebar: #FFFFFF;
    --bg-card: #FFFFFF;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    
    /* Accents */
    --accent-blue: #2563EB;
    --accent-purple: #7C3AED;
    --accent-green: #059669;
    --accent-orange: #D97706;
    --accent-red: #DC2626;

    /* Glow variations */
    --glow-blue: rgba(37, 99, 235, 0.1);
    --glow-purple: rgba(124, 58, 237, 0.1);
    --glow-green: rgba(5, 150, 105, 0.1);
    --glow-orange: rgba(217, 119, 6, 0.1);
    --glow-red: rgba(220, 38, 38, 0.1);

    /* UI elements */
    --border-color: #E2E8F0;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-card: 0 4px 20px rgba(0,0,0,0.05);
    --transition-fast: 0.2s ease;
}

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

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px 32px 24px;
    color: var(--text-primary);
}

.brand i {
    font-size: 24px;
    color: var(--accent-blue);
    filter: drop-shadow(0 0 8px var(--glow-blue));
}

.brand h1 {
    font-size: 20px;
    letter-spacing: -0.5px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 16px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    font-size: 15px;
    font-weight: 500;
}

.nav-item:hover {
    background-color: rgba(0,0,0,0.04);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--glow-blue);
    color: var(--accent-blue);
    border-left: 3px solid var(--accent-blue);
}

/* User Profile in Sidebar */
.user-profile {
    margin: 0 16px;
    padding: 16px;
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border-color);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

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

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px 48px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    position: relative;
    min-width: 0;
    transition: margin-left 0.25s ease;
}

/* Sidebar collapsada (toggle manual) */
.dashboard-container.sidebar-collapsed .sidebar {
    transform: translateX(-260px);
}
.dashboard-container.sidebar-collapsed .main-content {
    margin-left: 0;
}
.sidebar {
    transition: transform 0.25s ease;
}

/* Botón toggle sidebar — pequeño, fijo en la esquina sup-izq */
.sidebar-toggle-btn {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 100;
    background: rgba(255,255,255,0.95);
    color: #64748b;
    border: 1px solid #cbd5e1;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: left 0.25s ease, background 0.15s ease, color 0.15s ease;
}
.sidebar-toggle-btn:hover {
    background: white;
    color: #1e293b;
}
.dashboard-container:not(.sidebar-collapsed) .sidebar-toggle-btn {
    left: 224px;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.page-title {
    font-size: 28px;
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

.btn {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
    font-family: inherit;
}

.btn-primary {
    background-color: var(--accent-blue);
    color: white;
    box-shadow: 0 4px 12px var(--glow-blue);
}

.btn-primary:hover {
    background-color: #2563EB;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--glow-blue);
}

.notification-bell {
    position: relative;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.notification-bell:hover {
    color: var(--text-primary);
}

.badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background-color: var(--accent-red);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-main);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.stat-card {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.stat-card.glow-blue:hover { box-shadow: 0 10px 25px var(--glow-blue); border-color: rgba(59,130,246,0.5); }
.stat-card.glow-purple:hover { box-shadow: 0 10px 25px var(--glow-purple); border-color: rgba(139,92,246,0.5); }
.stat-card.glow-green:hover { box-shadow: 0 10px 25px var(--glow-green); border-color: rgba(16,185,129,0.5); }
.stat-card.glow-orange:hover { box-shadow: 0 10px 25px var(--glow-orange); border-color: rgba(245,158,11,0.5); }
.stat-card.glow-red:hover { box-shadow: 0 10px 25px var(--glow-red); border-color: rgba(239,68,68,0.5); }

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-card.glow-blue .card-icon { background-color: var(--glow-blue); color: var(--accent-blue); }
.stat-card.glow-purple .card-icon { background-color: var(--glow-purple); color: var(--accent-purple); }
.stat-card.glow-green .card-icon { background-color: var(--glow-green); color: var(--accent-green); }
.stat-card.glow-orange .card-icon { background-color: var(--glow-orange); color: var(--accent-orange); }
.stat-card.glow-red .card-icon { background-color: var(--glow-red); color: var(--accent-red); }

.card-details {
    flex: 1;
}

.card-title {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

.card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.card-trend {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.card-trend.positive { color: var(--accent-green); }
.card-trend.negative { color: var(--accent-red); }
.card-trend.neutral { color: var(--text-muted); }

.card-total-euros {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 2px 0 4px;
}

.stat-card.warning {
    border-left: 3px solid var(--accent-orange);
}

.stat-card.danger {
    border-left: 3px solid var(--accent-red);
}

/* Progress Card taking 2 columns */
.span-2 {
    grid-column: span 2;
}

.card-header {
    margin-bottom: 20px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

#text-ventas-actuales-progreso {
    font-weight: 600;
    color: var(--text-primary);
}

.progress-bar-container {
    width: 100%;
    height: 10px;
    background-color: rgba(0,0,0,0.05);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    transition: width 1.5s cubic-bezier(0.1, 0.8, 0.2, 1);
}

.progress-bar.glow {
    box-shadow: 0 0 10px var(--glow-purple);
}

/* Recent Activity Section */
.mt-4 { margin-top: 16px; }
.p-0 { padding: 0 !important; }

.activity-list {
    list-style: none;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item:hover {
    background-color: rgba(0,0,0,0.02);
}

.activity-item.type-ovidi .activity-icon { background-color: var(--glow-orange); color: var(--accent-orange); }
.activity-item.type-recibo .activity-icon { background-color: var(--glow-red); color: var(--accent-red); }
.activity-item.type-venta .activity-icon { background-color: var(--glow-green); color: var(--accent-green); }

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.activity-details {
    flex: 1;
}

.activity-text {
    font-size: 14px;
    margin-bottom: 4px;
}

.activity-text strong {
    color: var(--text-primary);
}

.activity-time {
    font-size: 12px;
    color: var(--text-muted);
}

.activity-loading {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    font-style: italic;
    animation: pulse 2s infinite;
}

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

/* Responsive */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .main-content {
        margin-left: 0;
        padding: 24px;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .span-2 {
        grid-column: span 1;
    }
    
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}

/* LOGIN STYLES */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: var(--bg-color);
}

.login-box {
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

.form-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: white;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* ======================================
   BIBLIOTECA DE DOCUMENTOS
   ====================================== */

.biblioteca-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.biblioteca-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.breadcrumb-item {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

.breadcrumb-item:hover {
    background: rgba(0,0,0,0.04);
    color: var(--text-primary);
}

.breadcrumb-item.active {
    color: var(--accent-blue);
    font-weight: 600;
}

.breadcrumb-separator {
    color: var(--text-muted);
    font-size: 12px;
}

.biblioteca-search {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    padding: 4px 12px;
    min-width: 200px;
    border: 1px solid var(--border-color);
}

.biblioteca-search i {
    color: var(--text-muted);
    font-size: 14px;
}

.biblioteca-search input {
    flex: 1;
    font-size: 14px;
    background: transparent;
}

.biblioteca-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background: rgba(0,0,0,0.04);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

/* File Grid */
.biblioteca-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.biblioteca-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
    font-size: 15px;
}

.biblioteca-empty p {
    margin-top: 16px;
}

/* File Cards */
.file-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.file-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    border-color: var(--accent-blue);
}

.file-card .file-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.file-card .file-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.3;
    max-height: 2.6em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.file-card .file-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.file-card .file-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(220, 38, 38, 0.08);
    color: var(--accent-red);
    font-size: 12px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.file-card:hover .file-delete {
    display: flex;
}

.file-card .file-delete:hover {
    background: var(--accent-red);
    color: white;
}

/* File type colors */
.file-icon.folder  { background: #FEF3C7; color: #D97706; }
.file-icon.pdf     { background: #FEE2E2; color: #DC2626; }
.file-icon.xlsx, .file-icon.xls, .file-icon.csv { background: #D1FAE5; color: #059669; }
.file-icon.doc, .file-icon.docx { background: #DBEAFE; color: #2563EB; }
.file-icon.ppt, .file-icon.pptx { background: #FDE8D8; color: #EA580C; }
.file-icon.jpg, .file-icon.jpeg, .file-icon.png, .file-icon.gif, .file-icon.webp { background: #EDE9FE; color: #7C3AED; }
.file-icon.default { background: #F1F5F9; color: #64748B; }

/* New folder modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

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

.modal-box {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 32px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-box h3 {
    margin-bottom: 16px;
    font-size: 18px;
}

.modal-box .form-input {
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Upload progress */
.upload-overlay {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideUp 0.3s ease;
}

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

.upload-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

@keyframes fichajePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.2); }
}

#fichaje-mini-widget:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

/* Responsive: en pantallas pequeñas, widget más compacto */
@media (max-width: 768px) {
    #fichaje-mini-widget {
        padding: 6px 8px !important;
        gap: 6px !important;
    }
    #fichaje-mini-reloj {
        font-size: 13px !important;
    }
    #fichaje-mini-estado {
        font-size: 9px !important;
    }
    #fichaje-mini-btn-pausa,
    #fichaje-mini-btn-reanudar {
        width: 24px !important;
        height: 24px !important;
    }
}

@media (max-width: 480px) {
    #fichaje-mini-widget {
        max-width: calc(100vw - 16px);
    }
}

/* ============== COTIZADOR: tarjetas grandes y responsive ==============
   - Contenedor de tarjetas: auto-fit con minmax(480px, 1fr). En desktop
     ancho aparecen 2 tarjetas grandes; en pantallas medianas 1 muy grande;
     en móvil 1 a pantalla completa.
   - Tipos de letra: bumpamos los clamp() máximos de los números clave
     mediante !important sobre los atributos data-cot-* y selectores
     específicos del card. */
.cotizador-layout {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr) !important;
    gap: 28px !important;
    align-items: start;
}

#cot-resultados-data {
    grid-template-columns: repeat(auto-fit, minmax(480px, 1fr)) !important;
    gap: 22px !important;
}

/* Prima Anual (número gigante en cabecera) */
[data-cot-annual],
#cot-resultados-data div[style*="PRIMA ANUAL"] + div,
#cot-resultados-data h3 ~ div div[style*="font-size:28px"] {
    font-size: clamp(30px, 5cqi, 56px) !important;
    line-height: 1.05 !important;
    letter-spacing: -0.5px;
}

/* 1er recibo (número grande de Sem/Trim/Mens) */
[data-cot-p-sem],
[data-cot-p-trim],
[data-cot-p-mens] {
    font-size: clamp(22px, 3.6cqi, 36px) !important;
    line-height: 1.1 !important;
}

/* Resto recibos (subtítulo bajo el número grande) */
[data-cot-r-sem],
[data-cot-r-trim],
[data-cot-r-mens] {
    font-size: inherit;
    font-weight: 700;
}

/* Etiquetas SEMESTRAL / TRIMESTRAL / MENSUAL — más legibles */
#cot-resultados-data div[style*="repeat(3"] > div > div:first-child {
    font-size: clamp(11px, 1.9cqi, 15px) !important;
    letter-spacing: 0.5px;
}

/* Filas del desglose por asegurado — texto un poco más grande */
#cot-resultados-data table {
    font-size: clamp(11px, 1.7cqi, 14px) !important;
}
#cot-resultados-data table thead th {
    font-size: clamp(10px, 1.5cqi, 13px) !important;
}

/* Tabletas / portátiles pequeños: el formulario lateral se va arriba */
@media (max-width: 1100px) {
    .cotizador-layout {
        grid-template-columns: 1fr !important;
    }
    #cot-resultados-data {
        grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)) !important;
    }
}

/* Móviles: una tarjeta por fila a anchura completa, paddings y fuentes adaptados */
@media (max-width: 700px) {
    #cot-resultados-data {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }
    [data-cot-annual] {
        font-size: clamp(28px, 9vw, 44px) !important;
    }
    [data-cot-p-sem],
    [data-cot-p-trim],
    [data-cot-p-mens] {
        font-size: clamp(18px, 5.5vw, 26px) !important;
    }
    /* Tabla de desglose: que no se desborde en móvil */
    #cot-resultados-data table {
        font-size: 11.5px !important;
    }
    #cot-resultados-data table th,
    #cot-resultados-data table td {
        padding: 3px 2px !important;
    }
}

@media (max-width: 420px) {
    #cot-resultados-data {
        gap: 10px !important;
    }
    [data-cot-annual] {
        font-size: 30px !important;
    }
}


/* Floating Chat Button */
.chat-widget-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.3);
    border: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-button:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 40px rgba(37, 99, 235, 0.4);
}

/* Chat Window */
.chat-window {
    width: 400px;
    height: 600px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    margin-bottom: 20px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: chat-open 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes chat-open {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-header {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header h3 {
    font-size: 16px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    animation: message-in 0.3s ease;
    overflow-wrap: break-word;
    word-break: break-word;
}

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

.message.user {
    background: var(--accent-blue);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message.bot {
    background: #F1F5F9;
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    line-height: 1.6;
    font-size: 13.5px;
}
.message.bot p { margin: 0 0 8px 0; }
.message.bot p:last-child { margin-bottom: 0; }
.message.bot ul { margin: 4px 0 8px 0; padding-left: 18px; }
.message.bot li { margin-bottom: 4px; }

.chat-input-area {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    background: white;
}

.chat-input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    outline: none;
    font-family: inherit;
    transition: var(--transition-fast);
}

.chat-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--glow-blue);
}

.chat-send-btn {
    background: var(--accent-blue);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.chat-send-btn:hover {
    background: var(--accent-purple);
}

.chat-loading {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 12px 16px;
    background: #F1F5F9;
    border-radius: var(--radius-md);
    align-self: flex-start;
    margin-bottom: 12px;
}

.chat-loading span {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: dot-pulse 1s infinite alternate;
}

.chat-loading span:nth-child(2) { animation-delay: 0.2s; }
.chat-loading span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-pulse {
    from { opacity: 0.3; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}
