/* Reset y Variables - LiveSync Pro Style Guide */
:root {
    /* BACKGROUNDS */
    --bg-primary: #050505;
    --bg-secondary: #06010f;
    --bg-card: #0f0f0f;
    --bg-input: #1a1a1a;
    --bg-black: #000000;

    /* GRISES */
    --slate-950: rgb(2 6 23);
    --slate-900: rgb(15 23 42);
    --slate-800: rgb(30 41 59);
    --slate-600: rgb(71 85 105);
    --slate-500: rgb(100 116 139);
    --slate-400: rgb(148 163 184);
    --slate-300: rgb(203 213 225);

    /* COLORES PRIMARIOS */
    --cyan-400: rgb(34 211 238);
    --cyan-500: rgb(6 182 212);
    --purple-500: rgb(168 85 247);

    /* ESTADOS */
    --red-500: rgb(239 68 68);
    --emerald-500: rgb(16 185 129);
    --emerald-400: rgb(52 211 153);

    /* BORDES Y DIVISORES */
    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-medium: rgba(255, 255, 255, 0.10);
    --border-strong: #222222;
    --border-input: #333333;

    /* SOMBRAS */
    --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--slate-400);
    background-color: var(--bg-primary);
    min-height: 100vh;
    /* iOS Safe Areas (notch, home indicator) */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

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

/* Header */
.header {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 0.5px solid rgba(6, 182, 212, 0.3);
    color: white;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.2);
}

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

/* Logo con estilo LiveSync Pro */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.logo svg {
    position: relative;
    filter: drop-shadow(0 0 10px rgba(6, 182, 212, 0.5));
    transition: var(--transition);
}

.logo:hover svg {
    filter: drop-shadow(0 0 20px rgba(6, 182, 212, 0.8));
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    background: linear-gradient(to right, var(--cyan-400), var(--purple-500));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Nav */
.nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--slate-400);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--cyan-400);
    border-color: var(--border-medium);
}

.nav-link.active {
    background: var(--cyan-500);
    color: black;
    font-weight: 700;
    border-color: var(--cyan-500);
}

.nav-link:active {
    transform: scale(0.95);
    opacity: 0.8;
}

.nav-link:focus-visible {
    outline: 2px solid var(--cyan-400);
    outline-offset: 2px;
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 200px);
}

.section {
    display: none;
    padding: 2rem 0;
    animation: fadeIn 500ms ease-in-out;
}

.section.active {
    display: block;
}

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

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

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

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

/* Hero Section */
.hero {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: 1rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 0.5px;
    background: var(--cyan-500);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

/* Glow effect en fondo */
.hero::after {
    content: '';
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 300px;
    background: var(--cyan-500);
    filter: blur(100px);
    opacity: 0.1;
    pointer-events: none;
    z-index: 0;
}

.hero > * {
    position: relative;
    z-index: 1;
}

.hero h2 {
    font-size: 2.25rem;
    margin-bottom: 1rem;
    color: white;
    font-weight: 700;
}

.subtitle {
    font-size: 1rem;
    color: var(--slate-400);
    margin-bottom: 2rem;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.stat-card {
    padding: 1.5rem;
    text-align: center;
    background: var(--bg-primary);
    border-radius: 0.75rem;
    border: 1px solid var(--border-subtle);
}

.stat-card i {
    font-size: 2rem;
    color: var(--cyan-400);
    margin-bottom: 0.5rem;
}

.stat-card h3 {
    font-size: 1.5rem;
    color: white;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.stat-card p {
    color: var(--slate-500);
    font-size: 0.875rem;
}

/* Quick Actions */
.quick-actions {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.quick-actions h3 {
    text-align: center;
    margin-bottom: 2rem;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.action-card {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.action-card:hover {
    border-color: var(--cyan-500);
    transform: translateY(-5px);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
}

.action-card:active {
    transform: scale(0.97);
    opacity: 0.9;
}

.action-card:focus-visible {
    outline: 2px solid var(--cyan-400);
    outline-offset: 4px;
}

.action-card i {
    font-size: 2.5rem;
    color: var(--cyan-400);
    margin-bottom: 1rem;
}

.action-card h4 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    color: white;
    font-weight: 600;
}

.action-card p {
    color: var(--slate-500);
    font-size: 0.875rem;
}

/* Recent Updates */
.recent-updates {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
}

.recent-updates h3 {
    margin-bottom: 1.5rem;
    color: white;
    font-weight: 700;
}

.update-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.update-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 0.75rem;
    align-items: flex-start;
}

.update-item i {
    font-size: 1.5rem;
    color: var(--emerald-400);
    margin-top: 0.25rem;
}

.update-item h4 {
    margin-bottom: 0.25rem;
    color: white;
    font-weight: 600;
}

.update-item p {
    color: var(--slate-400);
    font-size: 0.875rem;
}

.update-time {
    display: block;
    font-size: 0.75rem;
    color: var(--slate-500);
    margin-top: 0.5rem;
}

/* Chat Section */
.chat-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
    height: 700px;
}

.chat-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
}

.chat-sidebar h3 {
    margin-bottom: 1rem;
    color: white;
    font-weight: 700;
}

.agent-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 0.75rem;
    margin-bottom: 1rem;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--emerald-400);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    box-shadow: 0 0 10px var(--emerald-400);
}

.agent-status span {
    color: var(--slate-400);
    font-size: 0.875rem;
}

.chat-info {
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 0.75rem;
    color: var(--slate-400);
    font-size: 0.875rem;
}

.chat-info i {
    color: var(--cyan-400);
    margin-right: 0.5rem;
}

.chat-info a {
    color: var(--cyan-400);
    text-decoration: none;
    transition: var(--transition);
}

.chat-info a:hover {
    color: var(--cyan-500);
}

/* Chat Main */
.chat-main {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: 1rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.chat-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 0.5px;
    background: var(--cyan-500);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.chat-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    color: white;
    font-weight: 700;
}

.chat-status {
    color: var(--emerald-400);
    font-size: 0.875rem;
    font-weight: 500;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth; /* NUEVO: Scroll suave */
    will-change: scroll-position; /* NUEVO: Optimización GPU */
    /* Optimización de scroll para móviles */
    -webkit-overflow-scrolling: touch;
    /* Scroll snap para mejor experiencia */
    scroll-padding-bottom: 1rem;
}

/* Custom scrollbar - MEJORADO */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--slate-600);
    border-radius: 4px;
    transition: background 0.2s ease;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--slate-500);
}

/* Firefox scrollbar */
.chat-messages {
    scrollbar-width: thin;
    scrollbar-color: var(--slate-600) var(--bg-primary);
}

.message {
    display: flex;
    gap: 1rem;
    max-width: 80%;
    animation: slideUp 300ms ease-in-out;
}

.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;
    flex-shrink: 0;
    font-size: 1.25rem;
}

.message.bot .message-avatar {
    background: var(--cyan-500);
    color: black;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.message.user .message-avatar {
    background: var(--emerald-400);
    color: black;
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.5);
}

.message-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    padding: 1rem;
    border-radius: 0.75rem;
}

.message.user .message-content {
    background: var(--cyan-500);
    color: black;
    border-color: var(--cyan-500);
}

.message-content p {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

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

.message-time {
    font-size: 0.75rem;
    color: var(--slate-500);
    display: block;
    margin-top: 0.5rem;
}

.message.user .message-time {
    color: rgba(0, 0, 0, 0.6);
}

/* Chat Input */
.chat-input-container {
    padding: 1.5rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: 1rem;
}

.chat-input-container input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-input);
    background: var(--bg-input);
    color: white;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: var(--transition);
}

.chat-input-container input::placeholder {
    color: var(--slate-500);
}

.chat-input-container input:focus {
    outline: none;
    border-color: var(--cyan-500);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

/* Botón Primary (según guía) */
.btn-send {
    padding: 0.75rem 1.5rem;
    background: var(--cyan-500);
    color: black;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-send:hover {
    background: var(--cyan-400);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.5);
}

.btn-send:active {
    transform: scale(0.95);
}

.btn-send:focus-visible {
    outline: 2px solid var(--cyan-400);
    outline-offset: 3px;
}

/* NUEVO: Estados disabled */
.btn-send:disabled,
.chat-input-container input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-send:disabled {
    background: var(--slate-600);
    box-shadow: none;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    z-index: 2000;
    animation: fadeIn 300ms ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: 1rem;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: white;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--slate-400);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--red-500);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    color: var(--slate-400);
}

/* Footer */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-subtle);
    color: var(--slate-400);
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    color: var(--slate-400);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.875rem;
}

.footer-links a:hover {
    color: var(--cyan-400);
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(to right, var(--cyan-400), var(--purple-500));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glow-cyan {
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.glass {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
}

.animate-fade-in {
    animation: fadeIn 300ms ease-in-out;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Quick Action Buttons */
.quick-action-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin: 0.25rem 0.25rem 0 0;
    background: var(--cyan-500);
    color: black;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.quick-action-btn:hover {
    background: var(--cyan-400);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
    transform: translateY(-2px);
}

.quick-action-btn:active {
    transform: scale(0.95);
}

.quick-action-btn:focus-visible {
    outline: 2px solid var(--cyan-400);
    outline-offset: 2px;
}

.message.bot .message-content .quick-action-btn {
    background: rgba(6, 182, 212, 0.2);
    color: var(--cyan-400);
    border: 1px solid var(--cyan-500);
}

.message.bot .message-content .quick-action-btn:hover {
    background: var(--cyan-500);
    color: black;
}

/* Typing Indicator Animation */
.typing-dots {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    height: 1rem;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cyan-400);
    opacity: 0.4;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

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

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

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

@keyframes typing-bounce {
    0%, 60%, 100% {
        opacity: 0.4;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Links in message content */
.message-content a {
    color: var(--cyan-400);
    text-decoration: underline;
    transition: var(--transition);
}

.message-content a:hover {
    color: var(--cyan-500);
}

.message.user .message-content a {
    color: rgba(0, 0, 0, 0.8);
}

/* List items in messages */
.message-content li {
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

/* ========================================
   HAMBURGER MENU (Mobile)
   ======================================== */
.hamburger-menu {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.hamburger-menu span {
    width: 24px;
    height: 2px;
    background: var(--cyan-400);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.hamburger-menu:focus-visible {
    outline: 2px solid var(--cyan-400);
    outline-offset: 4px;
    border-radius: 0.25rem;
}

/* Scroll to bottom button */
.scroll-to-bottom {
    position: absolute;
    bottom: 5.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--cyan-500);
    color: black;
    border: none;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
    transition: all 0.3s ease;
    z-index: 100;
    opacity: 0;
    transform: scale(0.8);
}

.scroll-to-bottom.visible {
    display: flex;
    opacity: 1;
    transform: scale(1);
}

.scroll-to-bottom:hover {
    background: var(--cyan-400);
    box-shadow: 0 6px 16px rgba(6, 182, 212, 0.5);
    transform: scale(1.05);
}

.scroll-to-bottom:active {
    transform: scale(0.95);
}

.scroll-to-bottom:focus-visible {
    outline: 2px solid var(--cyan-400);
    outline-offset: 3px;
}

/* Sidebar toggle button (Mobile) - Touch target 44px */
.sidebar-toggle-btn {
    display: none;
    background: none;
    border: none;
    color: var(--cyan-400);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    transition: var(--transition);
}

.sidebar-toggle-btn:hover {
    color: var(--cyan-500);
}

.sidebar-toggle-btn:active {
    transform: scale(0.9);
    color: var(--cyan-400);
}

.sidebar-toggle-btn:focus-visible {
    outline: 2px solid var(--cyan-400);
    outline-offset: 3px;
    border-radius: 0.25rem;
}

/* Sidebar close button - Touch target 44px */
.sidebar-close {
    display: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--red-500);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
    z-index: 10;
}

.sidebar-close:hover {
    background: rgba(239, 68, 68, 0.2);
}

.sidebar-close:active {
    transform: scale(0.9);
    background: rgba(239, 68, 68, 0.3);
}

.sidebar-close:focus-visible {
    outline: 2px solid var(--red-500);
    outline-offset: 3px;
}

/* Chat header title (Mobile) */
.chat-header-title {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.chat-status-mobile {
    display: none;
    color: var(--emerald-400);
    font-size: 0.75rem;
    font-weight: 400;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-clear-history {
    background: none;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-clear-history:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
}

.btn-clear-history:active {
    transform: scale(0.98);
}

/* Responsive */
@media (max-width: 768px) {
    /* ========================================
       HEADER - Responsive
       ======================================== */
    .header {
        padding: 0.75rem 0;
    }

    .header .container {
        padding: 0 1rem;
    }

    /* Logo compacto en móviles */
    .logo {
        gap: 8px;
    }

    .logo img {
        width: 36px;
        height: 36px;
    }

    .logo-text {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .logo h1 {
        font-size: 0.875rem;
    }

    .logo-text p {
        display: none; /* Ocultar subtítulo en móviles */
    }

    /* Hamburger menu visible */
    .hamburger-menu {
        display: flex;
    }

    /* Nav menu oculto por defecto en móviles */
    .nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--bg-card);
        border-left: 1px solid var(--border-medium);
        flex-direction: column;
        padding: 5rem 1.5rem 1.5rem;
        gap: 0.5rem;
        transition: right 0.3s ease;
        z-index: 1000;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
    }

    .nav.active {
        right: 0;
    }

    .nav-link {
        padding: 1rem;
        border-radius: 0.5rem;
        width: 100%;
        text-align: left;
        background: var(--bg-primary);
        border: 1px solid var(--border-subtle);
        color: white;
    }

    .nav-link:hover {
        color: var(--cyan-400);
        background: rgba(255, 255, 255, 0.05);
    }

    .nav-link.active {
        background: rgba(6, 182, 212, 0.1);
        border-color: var(--cyan-400);
        color: white;
    }

    /* ========================================
       CHAT SECTION - Mobile (WhatsApp Style)
       ======================================== */
    .chat-container {
        grid-template-columns: 1fr;
        height: calc(100vh - 60px); /* Fullscreen minus header */
        gap: 0;
        margin: 0;
    }

    /* Sidebar oculto por defecto en móviles */
    .chat-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        z-index: 2000;
        transition: left 0.3s ease;
        padding: 4rem 1.5rem 1.5rem;
        border-radius: 0;
        border: none;
        border-right: 1px solid var(--border-medium);
        box-shadow: 5px 0 20px rgba(0, 0, 0, 0.5);
    }

    .chat-sidebar.active {
        left: 0;
    }

    .sidebar-close {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Chat main - Fullscreen tipo WhatsApp */
    .chat-main {
        height: 100%;
        border-radius: 0;
        border: none;
        border-top: 1px solid var(--border-medium);
        position: relative;
    }

    /* Scroll to bottom button on mobile */
    .scroll-to-bottom {
        bottom: 4.5rem;
        right: 1rem;
    }

    /* Chat header compacto */
    .chat-header {
        padding: 0.75rem 1rem;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border-medium);
        flex-wrap: nowrap;
        gap: 0.75rem;
    }

    .sidebar-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .chat-header h3 {
        font-size: 1rem;
        margin: 0;
    }

    .chat-status-mobile {
        display: block;
    }

    /* Ocultar elementos desktop en móvil */
    .chat-status {
        display: none;
    }

    .btn-clear-history .btn-text {
        display: none;
    }

    .btn-clear-history {
        background: none;
        border: 1px solid rgba(239, 68, 68, 0.3);
        color: var(--red-500);
        padding: 0.5rem;
        border-radius: 0.375rem;
        cursor: pointer;
        font-size: 1rem;
        transition: all 0.2s;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
    }

    .btn-clear-history:active {
        transform: scale(0.9);
        background: rgba(239, 68, 68, 0.1);
    }

    /* Chat messages - Más espacio */
    .chat-messages {
        padding: 1rem;
        gap: 0.75rem;
    }

    /* Messages - Estilo WhatsApp */
    .message {
        max-width: 85%;
    }

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

    .message.bot {
        align-self: flex-start;
    }

    /* Avatar más pequeño en móvil */
    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }

    /* Message content más compacto */
    .message-content {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .message-content p {
        font-size: 0.9rem;
    }

    .message-time {
        font-size: 0.75rem;
        color: var(--slate-400);
        opacity: 0.9;
    }

    /* Chat input - Fixed bottom tipo WhatsApp */
    .chat-input-container {
        padding: 0.75rem 1rem;
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
        background: var(--bg-card);
        border-top: 1px solid var(--border-medium);
        gap: 0.5rem;
    }

    #chatInput {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        border-radius: 1.5rem;
    }

    .btn-send {
        width: 44px;
        height: 44px;
        min-width: 44px;
        border-radius: 50%;
    }

    /* Quick action buttons - Touch targets mínimos 44px */
    .quick-action-btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Feedback buttons - Touch targets mínimos 44px */
    .feedback-buttons {
        margin-top: 0.5rem;
        gap: 0.5rem;
    }

    .feedback-btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* ========================================
       OTRAS SECCIONES - Mobile
       ======================================== */
    .hero h2 {
        font-size: 1.5rem;
    }

    .hero-stats {
        grid-template-columns: 1fr;
    }

    .action-grid {
        grid-template-columns: 1fr;
    }

    .footer .container {
        flex-direction: column;
        text-align: center;
    }

    /* Main content sin padding en chat */
    #chat .container {
        padding: 0;
        max-width: 100%;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .logo h1 {
        font-size: 0.75rem;
    }

    .message {
        max-width: 90%;
    }

    .nav {
        width: 100%;
        right: -100%;
    }

    .chat-sidebar {
        width: 90%;
        max-width: none;
    }
}
