/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow: hidden;
    height: 100vh;
}

:root {
    /* GoPing Brand Colors - Extraídos del logo */
    --primary-main: #1a237e; /* Azul oscuro principal del logo */
    --primary-light: #e8eaf6; /* Azul claro para fondos */
    --primary-dark: #0d1a5c; /* Azul más oscuro para hover */
    --secondary-main: #2196f3; /* Azul brillante del símbolo "g" */
    --secondary-light: #e3f2fd; /* Azul muy claro para fondos */
    --secondary-dark: #1565c0; /* Azul degradado del símbolo */
    --accent-blue: #1976d2; /* Azul de acento */
    --success-main: #22a454;
    --info-main: #2196f3; /* Usando el azul brillante */
    --info-light: #e3f2fd;
    --error-main: #f44336; /* Rojo más moderno */
    --warning-main: #ff9800; /* Naranja para advertencias */
    --grey-100: #f5f5f5; /* Fondo suave como el logo */
    --grey-200: #eeeeee;
    --grey-300: #e0e0e0;
    --grey-400: #9e9e9e;
    --grey-500: #757575;
    --grey-600: #424242;
    --text-primary: #212121; /* Negro suave */
    --text-secondary: #757575;
    --divider: #e0e0e0;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px 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);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Transitions */
    --transition-fast: 0.15s ease-in-out;
    --transition-normal: 0.3s ease-in-out;
    --transition-slow: 0.5s ease-in-out;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #f8faff 0%, #e8eaf6 100%);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

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

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-sm {
    gap: var(--spacing-sm);
}

.gap-md {
    gap: var(--spacing-md);
}

.gap-lg {
    gap: var(--spacing-lg);
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-main), var(--secondary-main));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity var(--transition-normal);
}

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

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-md);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Login Screen */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-main), var(--secondary-main));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* Register Screen */
.register-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-main), var(--secondary-main));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    overflow-y: auto;
    padding: var(--spacing-md);
}

.login-container,
.register-container {
    background: white;
    padding: var(--spacing-2xl);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 500px;
    margin: var(--spacing-md);
}

.register-container {
    max-width: 600px;
}

.login-header,
.register-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.logo i {
    font-size: 2.5rem;
    color: var(--primary-main);
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* GoPing Logo */
.goping-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-main) 0%, var(--secondary-main) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(26, 35, 126, 0.3);
    position: relative;
    overflow: hidden;
}

.goping-logo::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.2) 50%, transparent 70%);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.gp-text {
    font-size: 1.2rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

/* Logo de marca GoPing */
.goping-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    font-weight: 700;
    color: var(--text-primary);
}

.goping-brand h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-main), var(--secondary-main));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(26, 35, 126, 0.1);
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.login-form,
.register-form {
    margin-bottom: var(--spacing-xl);
}

.register-form {
    margin-bottom: var(--spacing-lg);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px solid var(--grey-200);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: border-color var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-main);
    box-shadow: 0 0 0 3px rgba(53, 212, 114, 0.1);
}

.form-group select {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px solid var(--grey-200);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.form-group small {
    display: block;
    margin-top: var(--spacing-xs);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1.4;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    margin-top: 2px;
}

.checkbox-label a {
    color: var(--primary-main);
    text-decoration: none;
}

.checkbox-label a:hover {
    text-decoration: underline;
}

.login-footer,
.register-footer {
    text-align: center;
}

.login-footer a,
.register-footer a {
    color: var(--primary-main);
    text-decoration: none;
    font-weight: 500;
}

.login-footer a:hover,
.register-footer a:hover {
    text-decoration: underline;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-main);
    color: white;
    box-shadow: 0 2px 8px rgba(26, 35, 126, 0.2);
}

.btn-primary:hover {
    background: var(--secondary-main);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.btn-secondary {
    background: var(--grey-200);
    color: var(--text-primary);
}

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

.btn-outline {
    background: transparent;
    color: var(--primary-main);
    border: 2px solid var(--primary-main);
}

.btn-outline:hover {
    background: var(--primary-main);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 35, 126, 0.2);
}

.btn-sm {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.85rem;
}

.btn-lg {
    padding: var(--spacing-lg) var(--spacing-xl);
    font-size: 1.1rem;
}

/* Main Application Layout */
.main-app {
    display: flex;
    height: 100vh;
    width: 100%;
    background: linear-gradient(135deg, #f8faff 0%, #e8eaf6 100%);
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, var(--primary-main) 0%, var(--primary-dark) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-normal);
    z-index: 100;
    box-shadow: 4px 0 20px rgba(26, 35, 126, 0.15);
    overflow: hidden;
}

.sidebar-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    min-height: 80px;
}

.sidebar-header .goping-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    font-weight: 700;
    color: white;
}

.sidebar-header .goping-brand h1 {
    color: white !important;
    background: none !important;
    -webkit-background-clip: unset !important;
    -webkit-text-fill-color: white !important;
    background-clip: unset !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    font-size: 1.2rem;
    color: white;
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-nav {
    flex: 1;
    padding: var(--spacing-md) 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sidebar-nav ul {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: 500;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--secondary-main);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.nav-item .badge {
    background: var(--error-main);
    color: white;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
    animation: badgePulse 2s ease-in-out infinite;
}

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

.sidebar-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-shrink: 0;
    min-height: 80px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex: 1;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-main);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 500;
    color: white;
}

.user-role {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.logout-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.2rem;
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.logout-btn:hover {
    background: rgba(244, 67, 54, 0.2);
    color: #ffcdd2;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100vh;
    max-height: 100vh;
}

/* Top Bar */
.top-bar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(26, 35, 126, 0.1);
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 50;
    box-shadow: 0 2px 20px rgba(26, 35, 126, 0.1);
    flex-shrink: 0;
    min-height: 60px;
    max-height: 60px;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
}

.top-bar-left h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: var(--spacing-md);
    color: var(--text-secondary);
}

.search-box input {
    padding: var(--spacing-sm) var(--spacing-sm) var(--spacing-sm) 2.5rem;
    border: 1px solid var(--grey-200);
    border-radius: var(--radius-md);
    background: var(--grey-100);
    width: 300px;
    font-size: 0.9rem;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-main);
    background: white;
}

.notifications {
    position: relative;
}

.notification-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    position: relative;
    transition: all var(--transition-fast);
}

.notification-btn:hover {
    background: var(--grey-200);
    color: var(--text-primary);
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--error-main);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Page Content */
#page-content {
    flex: 1;
    padding: var(--spacing-xl);
    overflow-y: auto;
    overflow-x: hidden;
    background: transparent;
    height: 100%;
}

#page-content::-webkit-scrollbar {
    width: 8px;
}

#page-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

#page-content::-webkit-scrollbar-thumb {
    background: rgba(26, 35, 126, 0.3);
    border-radius: 4px;
}

#page-content::-webkit-scrollbar-thumb:hover {
    background: rgba(26, 35, 126, 0.5);
}

#page-content > * {
    max-width: 100%;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        transform: translateX(-100%);
        z-index: 200;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-toggle,
    .mobile-menu-btn {
        display: block;
    }
    
    .search-box input {
        width: 200px;
    }
    
    .login-container {
        margin: var(--spacing-sm);
        padding: var(--spacing-xl);
    }
    
    .top-bar-right {
        gap: var(--spacing-sm);
    }
}

@media (max-width: 480px) {
    .search-box {
        display: none;
    }
    
    .login-container {
        padding: var(--spacing-lg);
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--grey-100);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--spacing-lg);
}

.modal-form .form-group {
    margin-bottom: var(--spacing-lg);
}

.modal-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

@media (max-width: 768px) {
    .modal-form .form-row {
        grid-template-columns: 1fr;
    }
}

.modal-form .form-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
    margin-top: var(--spacing-xl);
}

/* Card styles for new modules */
.broadcast-card,
.chatbot-card,
.template-card,
.user-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(26, 35, 126, 0.1);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border: 1px solid rgba(26, 35, 126, 0.1);
    transition: all 0.2s ease;
}

.broadcast-card:hover,
.chatbot-card:hover,
.template-card:hover,
.user-card:hover {
    box-shadow: 0 12px 40px rgba(26, 35, 126, 0.15);
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.95);
}

.broadcast-header,
.chatbot-header,
.template-header,
.user-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
}

.broadcast-header h3,
.chatbot-header h3,
.template-header h3,
.user-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.broadcast-status,
.chatbot-status,
.template-category,
.user-role {
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.broadcast-status.active,
.chatbot-status.active {
    background: var(--success-main);
    color: white;
}

.broadcast-status.inactive,
.chatbot-status.inactive {
    background: var(--grey-300);
    color: var(--text-secondary);
}

.template-category {
    background: var(--info-light);
    color: var(--info-main);
}

.user-role.admin {
    background: var(--error-main);
    color: white;
}

.user-role.user {
    background: var(--primary-light);
    color: var(--primary-main);
}

.user-role.agent {
    background: var(--secondary-light);
    color: var(--secondary-dark);
}

.broadcast-content,
.chatbot-content,
.template-content {
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
}

.broadcast-meta,
.user-meta {
    display: flex;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.broadcast-actions,
.chatbot-actions,
.template-actions,
.user-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.user-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-main);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-info {
    flex: 1;
}

.user-info h3 {
    margin: 0 0 var(--spacing-xs) 0;
    color: var(--text-primary);
}

.user-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Button styles */
.btn-sm {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.8rem;
}

.btn-danger {
    background: var(--error-main);
    color: white;
    border: 1px solid var(--error-main);
}

.btn-danger:hover {
    background: #e74c3c;
    border-color: #e74c3c;
}

.btn-warning {
    background: var(--warning-main);
    color: white;
    border: 1px solid var(--warning-main);
}

.btn-warning:hover {
    background: #f39c12;
    border-color: #f39c12;
}

/* ================================
   ESTILOS DE WHATSAPP
   ================================ */

/* Banner de estado de WhatsApp para difusión */
.whatsapp-status-broadcast {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border: 1px solid #fecaca;
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
}

.whatsapp-status-broadcast.connected {
  background: linear-gradient(135deg, var(--secondary-light) 0%, #e3f2fd 100%);
  border-color: var(--secondary-main);
}

.whatsapp-status-broadcast .status-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.whatsapp-status-broadcast .status-text {
  font-weight: 600;
  color: var(--text-primary);
}

.whatsapp-status-broadcast .status-actions {
  display: flex;
  gap: var(--spacing-sm);
}

/* Contenedor de mensajes */
.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #e5ddd5;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="%23ffffff" opacity="0.1"/><circle cx="10" cy="60" r="0.5" fill="%23ffffff" opacity="0.1"/><circle cx="90" cy="40" r="0.5" fill="%23ffffff" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    max-height: 400px;
}

/* Mensajes individuales - SOBRESCRITO por inbox-improved.css */
.message {
    margin-bottom: 10px;
    display: flex !important;
    flex-direction: row !important;
    width: 100%;
    clear: both;
}

.message.sent {
    justify-content: flex-end !important;
    flex-direction: row-reverse !important;
}

.message.received {
    justify-content: flex-start !important;
    flex-direction: row !important;
}

/* Burbujas de mensaje */
.message-bubble {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 18px;
    word-wrap: break-word;
    position: relative;
}

.message.sent .message-bubble {
    background: #dcf8c6;
    border-bottom-right-radius: 5px;
}

.message.received .message-bubble {
    background: white;
    border-bottom-left-radius: 5px;
}

/* Texto del mensaje */
.message-text {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 5px;
}

/* Tiempo del mensaje */
.message-time {
    font-size: 11px;
    color: #666;
    text-align: right;
}

/* Contenedor de entrada de mensaje */
.message-input-container {
    padding: 15px;
    border-top: 1px solid #e0e0e0;
    background: white;
}

.message-input-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.message-input-form input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
}

.message-input-form input:focus {
    border-color: #25d366;
}

.message-input-form button {
    background: #25d366;
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.message-input-form button:hover {
    background: #128c7e;
}

.message-input-form button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Chats de WhatsApp */
.whatsapp-chat {
    border-left: 3px solid #25d366;
}

.whatsapp-chat .conversation-avatar {
    background: #25d366;
    color: white;
}

/* Badge de mensajes no leídos */
.unread-badge {
    background: #25d366;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    margin-left: 10px;
    font-weight: 600;
}

/* Estado de conexión de WhatsApp */
.whatsapp-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.whatsapp-status.connected {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.whatsapp-status.disconnected {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.whatsapp-status.loading {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Status dots */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.status-dot.online {
    background: #22a454;
    animation: pulse 2s infinite;
}

.status-dot.offline {
    background: #FA896B;
}

.status-dot.waiting {
    background: #fbbf24;
    animation: pulse 2s infinite;
}

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

/* Contenedor QR */
#whatsapp-qr-container {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 10px;
    margin: 20px 0;
}

.qr-instructions h4 {
    color: #25d366;
    margin-bottom: 15px;
}

.qr-steps {
    margin-top: 15px;
    color: #666;
    font-size: 14px;
}

.qr-steps p {
    margin: 5px 0;
}

/* Sin mensajes */
.no-messages {
    text-align: center;
    color: #666;
    padding: 40px 20px;
    font-style: italic;
}

/* Responsive para WhatsApp */
@media (max-width: 768px) {
    .message-bubble {
        max-width: 85%;
    }
    
    .messages-container {
        padding: 15px;
    }
    
    .message-input-container {
        padding: 10px;
    }
    
    .message-input-form input {
        padding: 10px 12px;
        font-size: 16px; /* Evitar zoom en iOS */
    }
}

/* Animaciones para mensajes */
.message {
    animation: slideIn 0.3s ease-out;
}

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

/* Indicador de escritura */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 15px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 5px;
    max-width: 70px;
    margin-bottom: 10px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typing 1.4s infinite ease-in-out;
}

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

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

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

