/* ============================================
   IAPI v6.0 - Estilos Modernos
   ============================================ */

:root {
    /* Colores principales */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #06b6d4;
    --accent: #f59e0b;
    
    /* Estados */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    
    /* Fondos */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    
    /* Texto */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Bordes */
    --border-color: #334155;
    --border-radius-sm: 8px;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    
    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
    
    /* Transiciones */
    --transition-fast: 0.15s ease;
    --transition: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Espaciado */
    --space-xs: 4px;
    --space-sm: 8px;
    --space: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    
    /* Tipografía */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Reset y Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

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

/* ============================================
   Layout Principal
   ============================================ */

#app {
    display: grid;
    grid-template-areas:
        "header header"
        "sidebar main";
    grid-template-columns: 280px 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
}

/* Header */
.app-header {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space) var(--space-lg);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.logo-icon {
    font-size: 1.75rem;
    animation: pulse 2s ease-in-out infinite;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.version {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 20px;
}

.header-actions {
    display: flex;
    gap: var(--space-sm);
}

.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: var(--transition);
    position: relative;
}

.btn-icon:hover {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-icon .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--error);
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* Sidebar */
.sidebar {
    grid-area: sidebar;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: var(--space-lg);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.sidebar-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space);
}

/* Progress Ring */
.progress-ring-container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: var(--space);
}

.progress-ring {
    width: 120px;
    height: 120px;
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 8;
}

.progress-ring-fill {
    fill: none;
    stroke: url(#progressGradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 339.292;
    stroke-dashoffset: 339.292;
    transition: stroke-dashoffset 1s ease;
}

.progress-text {
    position: absolute;
    text-align: center;
}

.progress-text span {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.progress-text small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Fases Timeline */
.fases-timeline {
    display: flex;
    flex-direction: column;
    gap: var(--space);
}

.fase-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.fase-item:hover {
    background: var(--bg-tertiary);
}

.fase-item.active {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--primary);
}

.fase-item.completed {
    opacity: 0.7;
}

.fase-item.completed .fase-dot {
    background: var(--success);
}

.fase-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    flex-shrink: 0;
    margin-top: 4px;
    transition: var(--transition);
}

.fase-item.active .fase-dot {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

.fase-content {
    display: flex;
    flex-direction: column;
}

.fase-name {
    font-weight: 600;
    font-size: 0.9375rem;
}

.fase-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Kernberg Card */
.kernberg-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--border-radius);
    padding: var(--space);
    text-align: center;
    box-shadow: var(--shadow);
}

.kernberg-score {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.kernberg-score span:first-child {
    font-size: 2rem;
    font-weight: 700;
}

.kernberg-score small {
    font-size: 0.75rem;
    opacity: 0.8;
}

.kernberg-nivel {
    margin-top: var(--space-sm);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 4px 12px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
}

/* Tareas Preview */
.tareas-preview {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.tareas-preview .empty {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
    padding: var(--space);
}

.tarea-preview-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    font-size: 0.8125rem;
}

.tarea-preview-icon {
    font-size: 1rem;
}

.tarea-preview-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   Chat Container
   ============================================ */

.chat-container {
    grid-area: main;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space);
}

/* Mensajes */
.message {
    display: flex;
    gap: var(--space);
    max-width: 85%;
    animation: messageIn 0.3s ease;
}

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

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: var(--primary);
}

.message.assistant .message-avatar {
    background: var(--secondary);
}

.message-content {
    background: var(--bg-card);
    padding: var(--space);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    line-height: 1.7;
}

.message.user .message-content {
    background: var(--primary);
    border-color: var(--primary);
}

.message-content p {
    margin-bottom: var(--space-sm);
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul, .message-content ol {
    margin-left: var(--space);
    margin-bottom: var(--space-sm);
}

.message-content li {
    margin-bottom: var(--space-xs);
}

.message-content strong {
    color: var(--primary-light);
}

.message-content code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.875em;
}

.message-content pre {
    background: var(--bg-tertiary);
    padding: var(--space);
    border-radius: var(--border-radius-sm);
    overflow-x: auto;
    margin: var(--space-sm) 0;
}

.message-content pre code {
    background: none;
    padding: 0;
}

.message-time {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: var(--space);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

/* Chat Input */
.chat-input-area {
    padding: var(--space-lg);
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.input-wrapper {
    display: flex;
    gap: var(--space-sm);
    align-items: flex-end;
}

#message-input {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--space);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9375rem;
    resize: none;
    min-height: 56px;
    max-height: 150px;
    transition: var(--transition);
}

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

#message-input::placeholder {
    color: var(--text-muted);
}

.btn-send {
    width: 56px;
    height: 56px;
    background: var(--primary);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-send:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.btn-send svg {
    width: 24px;
    height: 24px;
    color: white;
}

.input-hints {
    margin-top: var(--space-sm);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* ============================================
   Paneles y Modales
   ============================================ */

.panel-overlay, .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.panel-overlay.active, .modal-overlay.active {
    display: flex;
    opacity: 1;
}

.panel {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.panel-overlay.active .panel {
    transform: scale(1);
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-lg {
    max-width: 800px;
}

.modal-sm {
    max-width: 400px;
}

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

.panel-header h2, .modal-header h2, .modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.panel-content, .modal-content {
    padding: var(--space-lg);
    overflow-y: auto;
    flex: 1;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.btn-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Formularios */
.form-group {
    margin-bottom: var(--space);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--space);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9375rem;
    transition: var(--transition);
}

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

.form-actions, .modal-actions {
    display: flex;
    gap: var(--space);
    justify-content: flex-end;
    margin-top: var(--space-lg);
}

/* Botones */
.btn-primary, .btn-secondary {
    padding: var(--space) var(--space-lg);
    border-radius: var(--border-radius);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

/* ============================================
   Tareas
   ============================================ */

.tareas-filters {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space);
    flex-wrap: wrap;
}

.filter-btn {
    padding: var(--space-sm) var(--space);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.tareas-list {
    display: flex;
    flex-direction: column;
    gap: var(--space);
    max-height: 400px;
    overflow-y: auto;
}

.tarea-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space);
    padding: var(--space);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.tarea-item:hover {
    border-color: var(--primary);
}

.tarea-item.completada {
    opacity: 0.6;
}

.tarea-item.completada .tarea-titulo {
    text-decoration: line-through;
}

.tarea-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.tarea-content {
    flex: 1;
}

.tarea-titulo {
    font-weight: 500;
    margin-bottom: var(--space-xs);
}

.tarea-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.tarea-meta {
    display: flex;
    gap: var(--space);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.tarea-actions {
    display: flex;
    gap: var(--space-sm);
}

.tarea-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.tarea-btn:hover {
    background: var(--primary);
}

.tarea-progress {
    margin-top: var(--space-sm);
}

.progress-bar {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 3px;
    transition: width 0.5s ease;
}

.tareas-actions {
    display: flex;
    gap: var(--space);
    margin-top: var(--space-lg);
    padding-top: var(--space);
    border-top: 1px solid var(--border-color);
}

/* ============================================
   Calendario
   ============================================ */

.calendario-estado {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-secondary);
}

.calendario-sugerencias {
    display: flex;
    flex-direction: column;
    gap: var(--space);
}

.sugerencia-card {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: var(--space);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.sugerencia-card:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}

.sugerencia-card.recomendada {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.sugerencia-fecha {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: var(--space-xs);
}

.sugerencia-hora {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.sugerencia-razon {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ============================================
   Informe
   ============================================ */

.informe-contenido {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: var(--space-lg);
    max-height: 60vh;
    overflow-y: auto;
    font-size: 0.9375rem;
    line-height: 1.8;
}

.informe-contenido h1,
.informe-contenido h2,
.informe-contenido h3 {
    margin-bottom: var(--space);
    color: var(--primary-light);
}

.informe-contenido p {
    margin-bottom: var(--space);
}

.informe-contenido ul,
.informe-contenido ol {
    margin-left: var(--space-lg);
    margin-bottom: var(--space);
}

/* ============================================
   Info Panel
   ============================================ */

.info-section {
    margin-bottom: var(--space-lg);
}

.info-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space);
    color: var(--primary-light);
}

.info-section p {
    margin-bottom: var(--space);
    color: var(--text-secondary);
}

.info-section ul {
    margin-left: var(--space-lg);
    color: var(--text-secondary);
}

.info-section li {
    margin-bottom: var(--space-sm);
}

/* ============================================
   Toast Notifications
   ============================================ */

#toast-container {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    z-index: 2000;
}

.toast {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: var(--space) var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    animation: toastIn 0.3s ease;
    max-width: 400px;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }
.toast.warning { border-left-color: var(--warning); }

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-message {
    flex: 1;
    font-size: 0.875rem;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
}

/* ============================================
   Loading Overlay
   ============================================ */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space);
}

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

.loading-spinner p {
    color: var(--text-secondary);
}

/* ============================================
   Animaciones
   ============================================ */

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1024px) {
    #app {
        grid-template-areas:
            "header"
            "main";
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .app-header {
        padding: var(--space);
    }

    .chat-messages {
        padding: var(--space);
    }

    .message {
        max-width: 95%;
    }
}

@media (max-width: 640px) {
    .panel, .modal {
        width: 95%;
        max-height: 95vh;
    }

    .form-actions, .modal-actions {
        flex-direction: column;
    }

    .form-actions button, .modal-actions button {
        width: 100%;
        justify-content: center;
    }

    .tareas-actions {
        flex-direction: column;
    }
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

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

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

/* Selección de texto */
::selection {
    background: var(--primary);
    color: white;
}

/* ============================================
   Login Overlay
   ============================================ */

.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 1rem;
    animation: fadeIn 0.4s ease;
}

.login-overlay.login-fadeout {
    animation: fadeOut 0.4s ease forwards;
}

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

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg), 0 0 40px rgba(99,102,241,0.1);
    animation: slideUp 0.4s ease;
}

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

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.login-logo-icon { font-size: 2rem; }
.login-logo-text { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.login-logo-version {
    font-size: 0.75rem;
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}

.login-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.login-features {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.75rem;
    text-align: left;
}
.login-feature {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
}

.login-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.btn-login-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0.75rem 1.25rem;
    background: white;
    color: #1f2937;
    border: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    width: 100%;
    font-family: inherit;
}
.btn-login-google:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
.btn-login-google:active { transform: translateY(0); }

.login-separator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.login-separator::before,
.login-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.btn-login-invitado {
    padding: 0.75rem 1.25rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    width: 100%;
    font-family: inherit;
}
.btn-login-invitado:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99,102,241,0.06);
}
.btn-login-invitado:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.login-legal {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* ============================================
   User Chip (header)
   ============================================ */

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 3px 10px 3px 4px;
    cursor: default;
    transition: var(--transition-fast);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    overflow: hidden;
    background: var(--bg-primary);
}

.user-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-logout-user {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    font-size: 0.75rem;
    line-height: 1;
    transition: color var(--transition-fast);
}
.btn-logout-user:hover { color: var(--error); }
