* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-bg: #1a0d1f;
    --light-bg: #f9fafb;
    --border-color: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 200% 200%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.login-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.login-shapes {
    position: relative;
    width: 100%;
    height: 100%;
}

.shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.1;
    animation: float 20s infinite ease-in-out;
}

.shape-1 {
    width: 300px;
    height: 300px;
    background: white;
    top: -150px;
    left: -150px;
    animation-delay: 0s;
}

.shape-2 {
    width: 200px;
    height: 200px;
    background: white;
    bottom: -100px;
    right: -100px;
    animation-delay: 5s;
}

.shape-3 {
    width: 150px;
    height: 150px;
    background: white;
    top: 50%;
    right: -75px;
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

.login-container {
    width: 100%;
    max-width: 440px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-box {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo {
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
}

.login-logo i {
    font-size: 56px;
    color: white;
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.login-header h1 {
    color: var(--text-primary);
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 400;
}

.login-form {
    margin-top: 8px;
}

.login-page .form-group {
    margin-bottom: 28px;
}

.login-page .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    letter-spacing: 0.3px;
}

.login-page .form-group label i {
    display: none; /* Ocultar iconos del label */
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    color: #9ca3af;
    font-size: 16px;
    pointer-events: none;
    z-index: 1;
    transition: all 0.3s;
    top: 50%;
    transform: translateY(-50%);
}

.login-page .form-group input {
    width: 100%;
    padding: 16px 18px;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 400;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #f9fafb;
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.login-page .form-group input:hover {
    border-color: #d1d5db;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.login-page .form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1), 0 4px 12px rgba(99, 102, 241, 0.15);
    transform: translateY(-1px);
}

.login-page .form-group input:focus ~ .input-icon {
    color: var(--primary-color);
    transform: translateY(-50%) scale(1.1);
}

.login-page .form-group input::placeholder {
    color: #9ca3af;
    font-weight: 400;
    opacity: 0.7;
}

.login-page .form-group input:not(:placeholder-shown) ~ .input-icon {
    color: var(--primary-color);
}

.login-submit {
    margin-top: 32px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    transition: all 0.3s;
}

.login-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
}

.login-submit:active {
    transform: translateY(0);
}

.login-submit i {
    transition: transform 0.3s;
}

.login-submit:hover i {
    transform: translateX(4px);
}

.login-page .error-message {
    margin-top: 20px;
    padding: 14px 16px;
    border-radius: 12px;
    animation: shake 0.4s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Responsive para login */
@media (max-width: 480px) {
    .login-box {
        padding: 36px 24px;
        border-radius: 20px;
    }
    
    .login-header h1 {
        font-size: 28px;
    }
    
    .login-logo i {
        font-size: 48px;
        width: 72px;
        height: 72px;
    }
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group textarea {
    font-family: 'Courier New', monospace;
    resize: vertical;
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 12px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

/* App Layout + Sidebar */
.app-layout {
    display: flex;
    min-height: 100vh;
    background: #f8fafc;
}

.navbar {
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    color: white;
    padding: 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
    width: 280px;
    position: sticky;
    top: 0;
    align-self: flex-start;
    z-index: 1000;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.navbar::-webkit-scrollbar {
    width: 6px;
}

.navbar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.navbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.navbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

body.sidebar-collapsed .navbar::-webkit-scrollbar {
    width: 4px;
}

.nav-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 24px 0;
}

.nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 24px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 11px;
    font-weight: 500;
    opacity: 0.7;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.sidebar-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 12px;
    flex: 1;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section:last-child {
    margin-bottom: 0;
}

.nav-section-bottom {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.5);
    padding: 0 16px 8px 16px;
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 12px 16px;
    border-radius: 10px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    font-weight: 500;
    position: relative;
    margin-bottom: 4px;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
    border-radius: 0 3px 3px 0;
    transition: height 0.25s ease;
}

.nav-link-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.nav-link-text {
    flex: 1;
    line-height: 1.4;
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
}

.nav-link:hover .nav-link-icon {
    transform: scale(1.1);
}

.nav-link.active {
    color: white;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.nav-link.active::before {
    height: 60%;
}

.nav-link.active .nav-link-icon {
    color: var(--primary-color);
    transform: scale(1.15);
}

.nav-link-danger {
    color: rgba(239, 68, 68, 0.9);
}

.nav-link-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.nav-link-danger.active {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
}

.nav-link-danger.active::before {
    background: linear-gradient(180deg, #ef4444, #dc2626);
}

/* Botón para colapsar sidebar en desktop */
.sidebar-collapse-btn {
    position: fixed;
    left: 280px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 48px;
    background: white;
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 14px;
    z-index: 999;
    transition: all 0.3s ease;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}

.sidebar-collapse-btn:hover {
    background: var(--light-bg);
    color: var(--primary-color);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
}

body.sidebar-collapsed .navbar {
    width: 80px;
    overflow-x: hidden;
}

body.sidebar-collapsed .nav-container {
    padding: 16px 0;
}

body.sidebar-collapsed .nav-header {
    padding: 0 12px 16px 12px;
    justify-content: center;
}

body.sidebar-collapsed .nav-brand {
    justify-content: center;
    gap: 0;
}

body.sidebar-collapsed .brand-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
}

body.sidebar-collapsed .nav-brand .brand-text {
    display: none;
}

body.sidebar-collapsed .nav-section-title {
    display: none;
}

body.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 12px;
    margin: 0 8px;
    border-radius: 8px;
}

body.sidebar-collapsed .nav-link-text {
    display: none;
}

body.sidebar-collapsed .nav-link-icon {
    margin: 0;
    width: 24px;
    height: 24px;
    font-size: 18px;
}

body.sidebar-collapsed .nav-menu {
    padding: 0 8px;
    overflow-x: hidden;
}

body.sidebar-collapsed .nav-section {
    margin-bottom: 16px;
}

body.sidebar-collapsed .nav-section-bottom {
    margin-top: auto;
    padding-top: 16px;
}

body.sidebar-collapsed .sidebar-toggle {
    display: none;
}

body.sidebar-collapsed .sidebar-collapse-btn {
    left: 80px;
}

body.sidebar-collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
}

/* Estilos para botones de iconos en historial */
.action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
    background: transparent;
}

.btn-icon-primary {
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.btn-icon-primary:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-icon-danger {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

.btn-icon-danger:hover {
    background: var(--danger-color);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Versión flotante en esquina inferior derecha */
/* Chatbot Toggle Button */
.chatbot-toggle {
    position: fixed;
    right: 16px;
    bottom: 60px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.chatbot-toggle:active {
    transform: scale(0.95);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(99, 102, 241, 0.7);
    }
}

/* Chatbot Modal */
.chatbot-modal {
    position: fixed;
    right: 16px;
    bottom: 130px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100vh - 150px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.chatbot-modal.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chatbot-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.chatbot-header-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-header-info p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

.chatbot-clear,
.chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    font-size: 14px;
}

.chatbot-clear:hover,
.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.chatbot-message {
    display: flex;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

.chatbot-message-user {
    flex-direction: row-reverse;
}

.chatbot-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.chatbot-message-user .chatbot-avatar-small {
    background: var(--text-secondary);
}

.chatbot-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chatbot-message-user .chatbot-message-content {
    background: var(--primary-color);
    color: white;
}

.chatbot-message-content p {
    margin: 0 0 8px 0;
    font-size: 14px;
    line-height: 1.5;
}

.chatbot-message-content p:last-child {
    margin-bottom: 0;
}

.chatbot-message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.chatbot-message-content li {
    margin: 4px 0;
    font-size: 13px;
}

.chatbot-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
}

.chatbot-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border-color: var(--primary-color);
}

.chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.chatbot-send:hover {
    transform: scale(1.1);
}

.chatbot-send:active {
    transform: scale(0.95);
}

.app-version {
    position: fixed;
    right: 16px;
    bottom: 12px;
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 50;
}

.app-version i {
    font-size: 10px;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: none;
    margin: 0;
    padding: 32px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    font-size: 40px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 12px;
    flex-shrink: 0;
}

.stat-icon i {
    font-size: 28px;
}

.stat-info h3 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Templates */
.templates-list {
    display: grid;
    gap: 20px;
}

.template-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.template-info h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.template-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

.template-badge {
    display: inline-block;
    padding: 4px 12px;
    background-color: var(--success-color);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
}

.template-actions {
    display: flex;
    gap: 8px;
}

/* Send Container */
.send-container {
    background: white;
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
}

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 32px;
    background: var(--light-bg);
    padding: 4px;
    border-radius: 12px;
}

.tab-btn {
    padding: 14px 28px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn i {
    font-size: 16px;
}

.tab-btn:hover {
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.tab-btn.active {
    color: white;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.tab-content {
    display: none;
    animation: fadeInContent 0.3s ease;
}

@keyframes fadeInContent {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-content.active {
    display: block;
}

.send-form {
    max-width: 700px;
    margin: 0 auto;
}

.send-form .form-group {
    margin-bottom: 24px;
}

.send-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.send-form input[type="text"],
.send-form input[type="email"],
.send-form select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: white;
}

.send-form input[type="text"]:focus,
.send-form input[type="email"]:focus,
.send-form select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.send-form small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 13px;
}

.send-form input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    background: var(--light-bg);
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-form input[type="file"]:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

/* Table */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.data-table th {
    padding: 18px 20px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: none;
}

.data-table td {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    background: white;
}

.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background: var(--light-bg);
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Estilos específicos para tabla de actividades */
.activity-table {
    border-radius: 12px;
    overflow: hidden;
}

.activity-row {
    border-left: 4px solid transparent;
}

.activity-row:hover {
    border-left-color: var(--primary-color);
}

.activity-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.activity-badge-create {
    background: #d1fae5;
    color: #065f46;
}

.activity-badge-update {
    background: #dbeafe;
    color: #1e40af;
}

.activity-badge-delete {
    background: #fee2e2;
    color: #991b1b;
}

.activity-badge-send {
    background: #fef3c7;
    color: #92400e;
}

.activity-badge-default {
    background: #e5e7eb;
    color: #374151;
}

.data-table tbody tr:hover {
    background-color: var(--light-bg);
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-secondary {
    background-color: #f3f4f6;
    color: #374151;
}

.status-enviado {
    background-color: #d1fae5;
    color: #065f46;
}

.status-rebotado {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-error {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-pendiente {
    background-color: #fef3c7;
    color: #92400e;
}

.history-controls {
    margin-bottom: 20px;
}

.schedule-origin-section {
    margin-top: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px dashed var(--border-color);
    background: #f9fafb;
}

.schedule-origin-section .form-group {
    margin-bottom: 10px;
}

.history-controls label,
#users-management-container label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

#history-items-per-page,
#users-items-per-page {
    padding: 8px 12px;
    font-size: 14px;
}

.form-control {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    min-width: 200px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-large {
    max-width: 1000px;
    width: 95%;
}

/* Modal de consola con tamaño fijo */
#consoleModal .modal-content {
    height: 85vh;
    max-height: 85vh;
}

.modal-header {
    padding: 28px 32px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.modal-header h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-header h2 i {
    font-size: 28px;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: white;
    line-height: 1;
    padding: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    background: white;
}

/* Modal body de consola con scroll */
#consoleModal .modal-body {
    display: flex;
    flex-direction: column;
    overflow: hidden; /* El scroll estará en el console-output */
    padding: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.error-message {
    background-color: #fee2e2;
    color: #991b1b;
    padding: 12px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 14px;
}

.success-message {
    background-color: #d1fae5;
    color: #065f46;
    padding: 12px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 14px;
}

.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    align-items: center;
    margin-top: 24px;
    flex-wrap: wrap;
}

.pagination button {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination button:hover:not(:disabled) {
    background-color: var(--light-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: #f3f4f6;
}

.pagination button.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    font-weight: 600;
}

.pagination button.active:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* Mejoras adicionales para el paginador */
.pagination button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.pagination button:active:not(:disabled) {
    transform: translateY(0);
}

/* Responsive para paginador */
@media (max-width: 768px) {
    .pagination {
        gap: 2px;
    }
    
    .pagination button {
        min-width: 36px;
        height: 36px;
        padding: 0 8px;
        font-size: 13px;
    }
    
    .pagination span {
        padding: 0 4px;
        min-width: 24px;
        height: 36px;
    }
}

/* Responsive */
/* Consola de envío */
.console-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.console-stats > div {
    background: #f0f0f0;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

#console-output {
    background: #1a1a1a;
    color: #00ff00;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    white-space: pre-wrap;
    line-height: 1.6;
    word-wrap: break-word;
}

/* Editor WYSIWYG Styles */
#editor-container-wrapper {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
}

#editor-container {
    height: 100%;
}

#editor-container .ql-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    height: 100%;
    border: none;
    border-top: 1px solid var(--border-color);
}

#editor-container .ql-toolbar {
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 12px;
    background: var(--light-bg);
    border-radius: 8px 8px 0 0;
}

#editor-container .ql-toolbar .ql-custom {
    border: none;
    cursor: pointer;
    display: inline-block;
    padding: 4px 8px;
    margin: 0 2px;
}

#editor-container .ql-toolbar .ql-custom:hover {
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

#editor-container .ql-editor {
    min-height: 450px;
    padding: 20px;
}

#editor-container .ql-editor.ql-blank::before {
    font-style: normal;
    color: var(--text-secondary);
}

#template-content {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
}

/* Estilos para el editor de imágenes */
#image-editor-container {
    max-width: 100%;
    max-height: 500px;
    overflow: auto;
}

#image-editor-container img {
    max-width: 100%;
    display: block;
}

/* Estilos para Cropper */
.cropper-container {
    max-width: 100%;
}

.cropper-view-box {
    outline: 2px solid var(--primary-color);
    outline-offset: -1px;
}

.cropper-face {
    background-color: rgba(99, 102, 241, 0.1);
}

.cropper-line {
    background-color: var(--primary-color);
}

/* Modal de Sesión Expirada - Estilos especiales */
#sessionExpiredModal .modal-content {
    max-width: 450px;
    text-align: center;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

#sessionExpiredModal .modal-header {
    padding: 40px 24px 0 24px;
}

#sessionExpiredModal .modal-body {
    padding: 20px 24px 40px 24px;
}

#sessionExpiredModal .modal-body p {
    line-height: 1.6;
}

#sessionExpiredModal #goToLoginBtn {
    padding: 12px 32px;
    font-size: 16px;
    font-weight: 600;
}

/* Estilos para la consola de envío */
#consoleModal .console-stats {
    flex-shrink: 0; /* No se encoge */
    margin-bottom: 20px;
}

#consoleModal #console-output {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #4a5568 #1a1a1a;
}

#consoleModal #console-output::-webkit-scrollbar {
    width: 8px;
}

#consoleModal #console-output::-webkit-scrollbar-track {
    background: #1a1a1a;
}

#consoleModal #console-output::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 4px;
}

#consoleModal #console-output::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

/* Estilos para imágenes interactivas en el editor */
.image-wrapper {
    display: inline-block;
    position: relative;
    margin: 5px;
}

.image-wrapper:hover {
    outline: 2px dashed var(--primary-color);
    outline-offset: 2px;
}

.image-delete-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.2s, background-color 0.2s;
}

.image-delete-btn:hover {
    transform: scale(1.1);
    background: #dc2626;
}

.image-resize-handle {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 16px;
    height: 16px;
    background: #6366f1;
    border: 2px solid white;
    border-radius: 50%;
    cursor: nwse-resize;
    z-index: 1000;
    transition: transform 0.2s, background-color 0.2s;
}

.image-resize-handle:hover {
    transform: scale(1.2);
    background: #4f46e5;
}

.interactive-image {
    cursor: move;
    position: relative;
    max-width: 100%;
    height: auto;
}

/* Permitir que el editor muestre HTML con estilos inline */
#editor-container .ql-editor {
    overflow: visible;
}

#editor-container .ql-editor * {
    max-width: 100%;
}

#editor-container .ql-editor img {
    display: inline-block;
    vertical-align: middle;
}

/* Overlay para móvil */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-open .sidebar-overlay {
    display: block;
    opacity: 1;
}

@media (max-width: 1024px) {
    .app-layout {
        position: relative;
    }

    .navbar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 32px rgba(0, 0, 0, 0.3);
    }

    body.sidebar-open .navbar {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .main-content {
        padding: 20px 16px;
    }
    
    .nav-header {
        padding: 20px 16px 20px 16px;
    }
    
    .nav-menu {
        padding: 0 8px;
    }
}

@media (max-width: 768px) {
    .navbar {
        width: 260px;
    }
    
    .brand-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .brand-title {
        font-size: 16px;
    }
    
    .brand-subtitle {
        font-size: 10px;
    }
    
    .nav-link {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .nav-link-icon {
        width: 18px;
        height: 18px;
        font-size: 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px;
    }

    .console-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease-out;
    min-width: 300px;
    border-left: 4px solid;
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast.info {
    border-left-color: var(--primary-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: var(--success-color);
}

.toast.error .toast-icon {
    color: var(--danger-color);
}

.toast.info .toast-icon {
    color: var(--primary-color);
}

.toast.warning .toast-icon {
    color: var(--warning-color);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s;
}

.toast-close:hover {
    color: var(--text-primary);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.fade-out {
    animation: slideOutRight 0.3s ease-out forwards;
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Pagination ellipsis */
.pagination span {
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    min-width: 32px;
    height: 40px;
    justify-content: center;
}

/* Nav link icons */
.nav-link i {
    margin-right: 6px;
    font-size: 14px;
}

/* Animación para nuevas actividades */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
