/**
 * Team Connections – Estilos del módulo de chat (Slack / Teams / Linear style).
 * Layout profesional con flexbox limpio y estructurado.
 * 
 * Estructura:
 * .tc-app-layout (flex column, min-height: 100vh)
 *   ├── .tc-app-header (sticky header)
 *   └── .tc-app-body (flex: 1, flex row)
 *       ├── .tc-sidebar (width: 320px, flex column)
 *       └── .tc-main-content (flex: 1, overflow-y: auto)
 */

/* ============================================
   RESET Y BASE
   ============================================ */

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* ============================================
   CONTENEDOR PADRE - Asegurar altura completa
   ============================================ */

/* El contenedor .flex-1 que contiene Team Connections debe ocupar toda la altura */
.flex-1:has(.tc-app-layout) {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Asegurar que ocupe todo el espacio disponible */
    flex: 1;
}

/* Fallback para navegadores sin soporte :has() */
.flex-1 > .tc-app-layout {
    height: 100%;
    min-height: 0;
    flex: 1;
}

/* Contenedor flex-1: debe crecer y dejar que tc-app-layout ocupe todo el espacio hasta el footer */
.flex.flex-col.min-h-screen > .flex-1:has(.tc-app-layout) {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* No forzar scroll en body para no romper el layout */
body:has(.tc-app-layout) {
    overflow: hidden;
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */

/* Contenedor principal - Estructura flexbox column */
/* Usa height: 100% para ocupar el espacio del contenedor padre, no el viewport */
.tc-app-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    background: #f1f5f9;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    /* Asegurar que ocupe todo el espacio disponible */
    flex: 1;
}

/* Header sticky - Se mantiene fijo al hacer scroll */
.tc-app-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    flex-shrink: 0;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    /* Asegurar que siempre esté visible */
    width: 100%;
    /* Asegurar que esté por encima del contenido */
    position: -webkit-sticky;
    position: sticky;
}

.tc-header__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.tc-header__left {
    min-width: 0;
    flex: 1;
}

.tc-header__title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.tc-header__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.3;
}

.tc-header__members-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #64748b;
}

.tc-header__members-icon {
    width: 18px;
    height: 18px;
    color: #64748b;
}

.tc-header__members-count {
    font-weight: 500;
}

.tc-header__badges {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.tc-header__badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    background: #f1f5f9;
    color: #475569;
}

.tc-header__badge--type { background: #e0e7ff; color: #4338ca; }
.tc-header__badge--status-active { background: #dcfce7; color: #166534; }
.tc-header__badge--status-in_review { background: #fef3c7; color: #92400e; }
.tc-header__badge--status-archived { background: #f1f5f9; color: #64748b; }

.tc-header__project-link {
    font-size: 12px;
    color: #3b82f6;
    text-decoration: none;
    margin-top: 6px;
    display: inline-block;
    font-weight: 500;
}

.tc-header__project-link:hover {
    text-decoration: underline;
}

.tc-header__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.tc-header__select {
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
}

.tc-header__btn {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.tc-header__btn--members {
    background: #f1f5f9;
    color: #475569;
}

.tc-header__btn--members:hover {
    background: #e2e8f0;
}

.tc-header__btn--ai {
    background: #7c3aed;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.tc-header__btn--ai:hover:not(:disabled) {
    background: #6d28d9;
}

.tc-header__btn--ai:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.tc-header__btn--delete {
    background: #fef2f2;
    color: #dc2626;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tc-header__btn--delete:hover:not(:disabled) {
    background: #fee2e2;
}

.tc-header__btn--delete:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Body principal - Flexbox row para sidebar + main (ocupa toda la altura hasta el footer) */
.tc-app-body {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
    align-items: stretch;
}

/* ============================================
   SIDEBAR
   ============================================ */

.tc-sidebar {
    width: 320px;
    min-width: 320px;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #1e293b;
    color: #e2e8f0;
    flex-shrink: 0;
    /* Que el bloque azul llegue hasta abajo (misma altura que el área de chat) */
    align-self: stretch;
    min-height: 100%;
}

.tc-sidebar__header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.tc-sidebar__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: -0.02em;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.tc-sidebar__subtitle {
    font-size: 13px;
    color: #cbd5e1;
    margin: 0 0 20px 0;
    line-height: 1.5;
    font-weight: 400;
    opacity: 0.9;
}

.tc-sidebar__filters {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.tc-sidebar__filter-btn {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    white-space: nowrap;
    text-align: center;
}

.tc-sidebar__filter-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #f1f5f9;
    transform: translateY(-1px);
}

.tc-sidebar__filter-btn.tc-sidebar__filter-btn--all.tc-sidebar__filter-btn--active,
.tc-sidebar__filter-btn--selected.tc-sidebar__filter-btn--all { 
    background: #3b82f6; 
    color: #fff; 
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}
.tc-sidebar__filter-btn--selected.tc-sidebar__filter-btn--filter-active { 
    background: #10b981; 
    color: #fff; 
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}
.tc-sidebar__filter-btn--selected.tc-sidebar__filter-btn--in_review { 
    background: #f59e0b; 
    color: #fff; 
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}
.tc-sidebar__filter-btn--selected.tc-sidebar__filter-btn--archived { 
    background: #64748b; 
    color: #fff; 
    box-shadow: 0 2px 8px rgba(100, 116, 139, 0.4);
}

.tc-sidebar__create-room {
    margin-top: 0;
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    background: #3b82f6;
    color: #fff;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tc-sidebar__create-room::before {
    content: '+';
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}

.tc-sidebar__create-room:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

.tc-sidebar__create-room:active {
    transform: translateY(0) scale(0.98);
}

.tc-sidebar__rooms {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 16px;
}

.tc-sidebar__rooms::-webkit-scrollbar { width: 6px; }
.tc-sidebar__rooms::-webkit-scrollbar-track { background: transparent; }
.tc-sidebar__rooms::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

.tc-sidebar__room {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 4px;
    border: 1px solid transparent;
    position: relative;
}

.tc-sidebar__room:hover {
    background: rgba(255, 255, 255, 0.08);
}

.tc-sidebar__room--active {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.1);
}

.tc-sidebar__room--active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: #3b82f6;
    border-radius: 0 3px 3px 0;
}

.tc-sidebar__room-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tc-sidebar__room-dot--active { 
    background: #22c55e; 
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
    animation: pulse-dot 2s ease-in-out infinite;
}
.tc-sidebar__room-dot--in_review { 
    background: #eab308; 
    box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.2);
}
.tc-sidebar__room-dot--archived { 
    background: #94a3b8; 
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.tc-sidebar__room-info {
    flex: 1;
    min-width: 0;
}

.tc-sidebar__room-name {
    font-size: 14px;
    font-weight: 500;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.tc-sidebar__room-meta {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 4px;
    line-height: 1.4;
    text-transform: capitalize;
}

.tc-sidebar__room-meta::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    margin-right: 6px;
    vertical-align: middle;
}

.tc-sidebar__empty {
    padding: 32px 20px;
    text-align: center;
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.5;
}

.tc-sidebar__loading {
    padding: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.tc-main-content {
    flex: 1;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden; /* Sin scroll aquí, solo en messages-wrap */
    align-self: stretch;
}

/* Contenedor del chat cuando hay una sala seleccionada - ocupa toda la altura para que el input quede abajo */
.tc-chat-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
}

.tc-main__empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 14px;
    padding: 24px;
}

/* Resumen IA */
.tc-ai-summary {
    flex-shrink: 0;
    margin: 0;
    padding: 12px 20px;
    background: #f5f3ff;
    border-bottom: 1px solid #e9e5ff;
    font-size: 12px;
    color: #5b21b6;
    line-height: 1.45;
}

/* Área de mensajes - ÚNICA área con scroll; ocupa todo el espacio para que el input quede abajo */
.tc-messages-wrap {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    background: #f8fafc;
    /* Asegurar que ocupe todo el espacio disponible entre header y footer */
    display: flex;
    flex-direction: column;
    position: relative;
    /* Asegurar que el scroll funcione correctamente */
    -webkit-overflow-scrolling: touch;
}

.tc-messages-wrap::-webkit-scrollbar { width: 8px; }
.tc-messages-wrap::-webkit-scrollbar-track { background: #f1f5f9; }
.tc-messages-wrap::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.tc-messages-wrap::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.tc-messages {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 24px 24px;
    width: 100%;
}

.tc-messages__loading {
    display: flex;
    justify-content: center;
    padding: 32px;
}

.tc-msg {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 20px;
    animation: tc-msg-in 0.2s ease-out;
}

@keyframes tc-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.tc-msg--own {
    flex-direction: row-reverse;
}

.tc-msg__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
    border: 2px solid #fff;
}

.tc-msg--own .tc-msg__avatar {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    border: 2px solid #fff;
}

.tc-msg__body {
    flex: 1;
    min-width: 0;
    max-width: 75%;
}

.tc-msg--own .tc-msg__body {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.tc-msg__meta {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 6px;
    font-weight: 500;
}

.tc-msg--own .tc-msg__meta {
    text-align: right;
    order: 2;
    margin-top: 4px;
    margin-bottom: 0;
}

.tc-msg__bubble {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #0f172a;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
    white-space: pre-wrap;
    word-break: break-word;
    max-width: 100%;
    order: 1;
}

.tc-msg--own .tc-msg__bubble {
    background: #3b82f6;
    color: #fff;
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
    margin-left: auto;
}

.tc-msg__files {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tc-msg__file-link {
    font-size: 12px;
    color: #3b82f6;
    text-decoration: none;
}

.tc-msg__file-link:hover {
    text-decoration: underline;
}

.tc-msg--own .tc-msg__file-link {
    color: #c7d2fe;
}

/* Barra de entrada (footer del chat) - FIJA justo encima del footer */
.tc-input-bar {
    flex: 0 0 auto;
    padding: 20px 24px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.04);
    width: 100%;
    margin-top: auto;
    position: relative;
    z-index: 10;
}

.tc-input-bar__form {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 24px;
    border: 1px solid #e2e8f0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tc-input-bar__form:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.tc-input-bar__attach,
.tc-input-bar__emoji {
    flex-shrink: 0;
    padding: 8px;
    color: #64748b;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tc-input-bar__attach:hover,
.tc-input-bar__emoji:hover {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.tc-input-bar__input {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
    font-size: 14px;
    line-height: 1.5;
    border: none;
    background: transparent;
    color: #0f172a;
    outline: none;
}

.tc-input-bar__input::placeholder {
    color: #94a3b8;
}

.tc-input-bar__send {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: #3b82f6;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.tc-input-bar__send:hover:not(:disabled) {
    background: #2563eb;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.45);
}

.tc-input-bar__send:active:not(:disabled) {
    transform: scale(0.95);
}

.tc-input-bar__send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tc-input-bar__file-hint {
    max-width: 720px;
    margin: 8px auto 0;
    font-size: 11px;
    color: #64748b;
    padding: 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tc-input-bar__file-hint button {
    color: #ef4444;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 2px;
    font-size: inherit;
}

.tc-input-bar__file-hint button:hover {
    text-decoration: underline;
}

/* ============================================
   MODALES
   ============================================ */

.tc-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    padding: 16px;
}

.tc-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
    max-width: 28rem;
    width: 100%;
    padding: 24px;
}

.tc-modal--members {
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.tc-modal__title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 16px 0;
}

.tc-modal__field {
    margin-bottom: 12px;
}

.tc-modal__label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
}

.tc-modal__input,
.tc-modal__select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}

.tc-modal__input:focus,
.tc-modal__select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.tc-modal__actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.tc-modal__btn--secondary {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    color: #475569;
    background: #f1f5f9;
    border: none;
    cursor: pointer;
}

.tc-modal__btn--secondary:hover {
    background: #e2e8f0;
}

.tc-modal__btn--primary {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    background: #3b82f6;
    border: none;
    cursor: pointer;
}

.tc-modal__btn--primary:hover:not(:disabled) {
    background: #2563eb;
}

.tc-modal__btn--primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tc-modal__members {
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 16px;
}

.tc-modal__member-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

.tc-modal__member-row button {
    font-size: 12px;
    color: #dc2626;
    background: none;
    border: none;
    cursor: pointer;
}

.tc-modal__member-row button:hover {
    text-decoration: underline;
}

.tc-modal__add-row {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.tc-modal__add-row select {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 767px) {
    .tc-app-body {
        flex-direction: column;
    }

    .tc-sidebar {
        width: 100%;
        max-width: none;
        min-width: 0;
        max-height: 40vh;
    }

    .tc-main-content {
        flex: 1;
        min-height: 200px;
    }

    .tc-messages {
        padding: 12px 16px 16px;
    }

    .tc-input-bar {
        padding: 12px 16px 16px;
    }

    .tc-app-header {
        padding: 12px 16px 10px;
    }

    .tc-header__title {
        font-size: 1.1rem;
    }

    .tc-msg__body {
        max-width: 92%;
    }
}

/* ============================================
   BOTÓN FLOTANTE DEL CHAT
   ============================================ */

/* Asegurar que el botón flotante esté siempre visible y correctamente posicionado */
.fixed.bottom-8.right-8 {
    position: fixed !important;
    bottom: 32px !important;
    right: 32px !important;
    z-index: 2000 !important;
}

.fixed.bottom-8.right-8 button {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.fixed.bottom-8.right-8 button:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.fixed.bottom-8.right-8 button:active {
    transform: translateY(0) scale(0.95);
}

@media (max-width: 768px) {
    .fixed.bottom-8.right-8 {
        bottom: 24px !important;
        right: 24px !important;
    }
}

/* ============================================
   FOOTER VISIBLE - Team Connections ocupa el espacio encima
   ============================================ */
/* El footer se mantiene visible; .tc-app-layout usa flex:1 y llena el espacio hasta el footer */
.flex-1:has(.tc-app-layout) {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.flex-1:has(.tc-app-layout) .tc-app-layout {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
/* El footer no se comprime y queda siempre abajo */
.flex-1:has(.tc-app-layout) > footer {
    flex-shrink: 0;
}

/* ============================================
   MODAL DE RESUMEN IA - Estilo Premium SaaS
   ============================================ */

.tc-modal-overlay--ai-summary {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.tc-modal--ai-summary {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.05);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.tc-modal__header-ai {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
}

.tc-modal__language-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 28px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    flex-shrink: 0;
}

.tc-modal__lang-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #6b7280;
    position: relative;
}

.tc-modal__lang-btn:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tc-modal__lang-btn--active {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.tc-modal__lang-btn--active:hover {
    background: #7c3aed;
    border-color: #7c3aed;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.tc-modal__lang-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #9ca3af;
}

.tc-modal__lang-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

.tc-modal__title-ai {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.tc-modal__close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    color: #6b7280;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tc-modal__close-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.tc-modal__body-ai {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    background: #ffffff;
}

.tc-modal__loading-ai {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
    color: #6b7280;
}

.tc-modal__loading-ai p {
    font-size: 1rem;
    margin: 0;
}

.tc-modal__content-ai {
    color: #374151;
    line-height: 1.7;
    font-size: 0.95rem;
}

.tc-modal__content-ai .ai-summary-h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 24px 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e7eb;
}

.tc-modal__content-ai .ai-summary-h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin: 20px 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tc-modal__content-ai .ai-summary-h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
    margin: 16px 0 8px 0;
}

.tc-modal__content-ai .ai-summary-ul {
    list-style: none;
    padding: 0;
    margin: 12px 0;
}

.tc-modal__content-ai .ai-summary-li {
    padding: 8px 0 8px 24px;
    position: relative;
    color: #4b5563;
}

.tc-modal__content-ai .ai-summary-li::before {
    content: "•";
    position: absolute;
    left: 8px;
    color: #8b5cf6;
    font-weight: bold;
    font-size: 1.2rem;
}

.tc-modal__content-ai strong {
    color: #111827;
    font-weight: 600;
}

.tc-modal__content-ai em {
    color: #6b7280;
    font-style: italic;
}

.tc-modal__error-ai {
    padding: 40px 20px;
    text-align: center;
    color: #dc2626;
}

.tc-modal__footer-ai {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 28px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    flex-shrink: 0;
}

.tc-modal__btn-ai {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.tc-modal__btn-ai--regenerate {
    background: #8b5cf6;
    color: #ffffff;
}

.tc-modal__btn-ai--regenerate:hover:not(:disabled) {
    background: #7c3aed;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.tc-modal__btn-ai--regenerate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tc-modal__btn-ai--copy {
    background: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
}

.tc-modal__btn-ai--copy:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tc-modal__btn-ai--close {
    background: transparent;
    color: #6b7280;
    border: 1px solid transparent;
}

.tc-modal__btn-ai--close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Responsive */
@media (max-width: 768px) {
    .tc-modal--ai-summary {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 12px;
    }

    .tc-modal__header-ai {
        padding: 20px;
    }

    .tc-modal__title-ai {
        font-size: 1.25rem;
    }

    .tc-modal__language-selector {
        padding: 12px 20px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .tc-modal__lang-btn {
        flex: 1;
        min-width: calc(33.333% - 4px);
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .tc-modal__body-ai {
        padding: 20px;
    }

    .tc-modal__footer-ai {
        flex-direction: column;
        padding: 16px 20px;
    }

    .tc-modal__btn-ai {
        width: 100%;
        justify-content: center;
    }
}
