/* Portada (index.html): estilos generales. Se carga antes de tema.css, que los ajusta. */
:root {
    --ucasal-red: #C8102E;
    --ucasal-blue: #0F172A;
    --ucasal-light: #F8FAFC;
    --ucasal-accent: #3B82F6;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Manrope', sans-serif;
    background-color: var(--ucasal-light);
    color: #1e293b;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* Custom Toast Notification System */
#toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 999999;
    pointer-events: none;
    max-width: 380px;
    width: calc(100% - 4rem);
}

.toast {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    pointer-events: auto;
    font-family: 'Manrope', sans-serif;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 5px solid #64748b;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #0f172a;
    margin-bottom: 0.15rem;
}

.toast-message {
    font-size: 0.8rem;
    color: #475569;
    line-height: 1.4;
}

/* Semantics */
.toast.success {
    border-left-color: #10b981;
}

.toast.success i {
    color: #10b981;
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.error i {
    color: #ef4444;
}

.toast.info {
    border-left-color: #3b82f6;
}

.toast.info i {
    color: #3b82f6;
}

.toast.warning {
    border-left-color: #f59e0b;
}

.toast.warning i {
    color: #f59e0b;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Header */
.header {
    background: var(--ucasal-blue);
    padding: 1.5rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header.scrolled {
    padding: 0.8rem 0;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(15px);
}

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

/* Buttons */
.btn {
    padding: 0.8rem 1.8rem;
    border-radius: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.btn-primary {
    background: var(--ucasal-red);
    color: white;
    box-shadow: 0 10px 20px rgba(200, 16, 46, 0.2);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(200, 16, 46, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.btn-outline {
    background: white;
    border: 1px solid #e2e8f0;
    color: var(--ucasal-blue);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.btn-outline:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* Triage: aviso de emergencia (único), acciones compactas y botón de escucha */
/* El aviso de la IA, los consentimientos y el chat del formulario están en consulta.css. */
#triage-acciones { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.6rem 1rem; background: #fff; border-top: 1px solid #e2e8f0; }
#triage-acciones:not(:has(> button:not([hidden]), > p:not([hidden]))) { display: none; }
.triage-accion { flex: 1 1 220px; padding: 0.55rem 1rem; font-size: 0.85rem; cursor: pointer; }
.triage-accion[hidden] { display: none !important; }
.triage-avance { height: 4px; background: #e2e8f0; flex: none; }
.triage-avance span { display: block; height: 100%; width: 0; background: var(--ucasal-blue); border-radius: 0 2px 2px 0; transition: width 0.6s ease; }
.typing-texto { font-style: normal; font-size: 0.85rem; color: #64748b; margin-left: 0.5rem; } /* .btn fija display y anulaba el atributo hidden */

/* Hero */
.hero {
    padding: 12rem 0 8rem;
    background: radial-gradient(circle at top right, #1e293b, #0F172A);
    color: white;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.1;
}

.hero-layout {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 4rem;
    align-items: center;
}

.hero-title {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 2rem;
    letter-spacing: -1px;
}

.hero-title span {
    color: var(--ucasal-red);
}

.hero-description {
    font-size: 1.25rem;
    color: #64748b;
    margin-bottom: 3.5rem;
    max-width: 650px;
    font-weight: 300;
}

/* Stats Cards */
.hero-stats {
    position: relative;
    height: 350px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: absolute;
    width: 260px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.stat-icon {
    width: 45px;
    height: 45px;
    border-radius: 1rem;
    background: #C8102E22;
    color: var(--ucasal-red);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: #64748b;
}

/* Sections General */
section {
    padding: 100px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-tag {
    color: var(--ucasal-red);
    font-weight: 700;
    font-size: 0.8rem;
    display: block;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 2.5rem;
    color: var(--ucasal-blue);
    font-weight: 800;
}

/* Cards Style */
.glass-card {
    background: white;
    border-radius: 2rem;
    border: 1px solid #e2e8f0;
    padding: 2.5rem;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.glass-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.05);
    border-color: var(--ucasal-red);
}

/* Grid Areas */
.areas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.area-icon {
    width: 60px;
    height: 60px;
    background: #FFF1F2;
    border-radius: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ucasal-red);
    margin-bottom: 1.5rem;
}

/* LegalTech Section */
.legaltech {
    background: var(--ucasal-blue);
    color: white;
    border-radius: 3rem;
    margin: 4rem 0;
    padding: 5rem;
    position: relative;
}

.legaltech-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.feature-item {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.feature-icon {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    height: fit-content;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1.5rem;
}

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

.modal-content {
    background: white;
    border-radius: 2.5rem;
    width: 100%;
    max-width: 650px;
    position: relative;
    padding: 3.5rem;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.2);
}

.close-modal {
    position: absolute;
    top: 2rem;
    right: 2rem;
    cursor: pointer;
    background: #f1f5f9;
    border-radius: 50%;
    padding: 0.6rem;
    display: flex;
    transition: all 0.3s;
}

.close-modal:hover {
    background: var(--ucasal-red);
    color: white;
    transform: rotate(90deg);
}

#chat-messages {
    height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.5rem;
    background: #F8FAFC;
    border-radius: 2rem;
    margin-bottom: 1.5rem;
    scroll-behavior: smooth;
}

#chat-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Burbuja de Escritura del Bot (Typing Indicator) */
.typing-bubble {
    align-self: flex-start;
    background: #ffffff;
    color: #0f172a;
    padding: 0.9rem 1.25rem;
    border-radius: 1rem 1rem 1rem 0;
    max-width: 85%;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.05);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-bubble span {
    width: 7px;
    height: 7px;
    background: var(--ucasal-red);
    border-radius: 50%;
    display: inline-block;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-bubble span:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0.4);
        opacity: 0.4;
    }

    40% {
        transform: scale(1.1);
        opacity: 1;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate {
    animation: fadeIn 0.8s ease forwards;
}

/* Footer */
.footer {
    background: var(--ucasal-blue);
    color: white;
    padding: 80px 0 40px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 4rem;
}

.footer-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.footer-link {
    color: #64748b;
    text-decoration: none;
    display: block;
    margin-bottom: 0.75rem;
    transition: color 0.3s;
}

.footer-link:hover {
    color: white;
}

button.footer-link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-align: left; }

/* Mobile Adjustments */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.8rem;
    }

    .hero-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .hero-stats {
        height: auto;
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .stat-card {
        position: static;
        width: 100%;
    }

    .legaltech-content {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .nav-actions {
        display: none;
    }

    .modal-content {
        padding: 2rem;
    }
}

.typing-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #ffffff;
    padding: 0.8rem 1rem;
    border-radius: 1rem 1rem 1rem 0;
    width: fit-content;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.05);
    align-self: flex-start;
    margin-bottom: 0.5rem;
}

.typing-bubble span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-bubble span:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}
