* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1a5f7a;
    --secondary-color: #159895;
    --accent-color: #57c5b6;
    --whatsapp-color: #25D366;
    --danger-color: #dc3545;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --dark-color: #1e293b;
    --light-color: #f8f9fa;
    --gray-color: #6c757d;
    --border-color: #dee2e6;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.app-container {
    width: 1400px;
    max-width: 100%;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

/* Header Styles */
.main-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 20px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.header-text h1 {
    font-size: 24px;
    font-weight: 600;
}

.badge {
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 2s infinite;
}

.status-indicator.online {
    background: var(--success-color);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    min-height: 600px;
}

/* Chat Panel Styles */
.chat-panel {
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: #f9f9f9;
}

.chat-header {
    padding: 20px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-header i {
    font-size: 24px;
    color: var(--whatsapp-color);
}

.chat-header h3 {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
}

.chat-status {
    font-size: 12px;
    color: var(--success-color);
    background: rgba(40, 167, 69, 0.1);
    padding: 4px 8px;
    border-radius: 20px;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 400px;
    max-height: 500px;
}

.message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.message.bot {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-content {
    max-width: 80%;
    padding: 12px 15px;
    border-radius: 15px;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.message.bot .message-content {
    background: white;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.message.user .message-content {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 5px;
}

.message-content i {
    font-size: 14px;
    margin-top: 2px;
}

.message-content p {
    font-size: 14px;
    line-height: 1.5;
}

.message-time {
    font-size: 10px;
    opacity: 0.7;
    margin-left: 10px;
}

.chat-input-area {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
}

.chat-input-area input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(26, 95, 122, 0.1);
}

.chat-input-area input:disabled {
    background: #f0f0f0;
    cursor: not-allowed;
}

.chat-input-area button {
    width: 45px;
    height: 45px;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-input-area button:hover:not(:disabled) {
    background: var(--secondary-color);
    transform: scale(1.05);
}

.chat-input-area button:disabled {
    background: var(--gray-color);
    cursor: not-allowed;
    opacity: 0.5;
}

.chat-footer {
    padding: 10px 20px;
    background: #f0f0f0;
    font-size: 12px;
    text-align: center;
    color: var(--gray-color);
}

/* Info Panel Styles */
.info-panel {
    padding: 20px;
    background: white;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.qr-card, .areas-card, .prospects-card {
    background: #f9f9f9;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.qr-card h3, .areas-card h3, .prospects-card h3 {
    font-size: 16px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--dark-color);
}

.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.qr-code {
    width: 200px;
    height: 200px;
    background: white;
    padding: 10px;
    border-radius: 10px;
}

.qr-code img {
    width: 100%;
    height: 100%;
}

.qr-note {
    font-size: 12px;
    color: var(--gray-color);
}

.whatsapp-link {
    margin-top: 15px;
    text-align: center;
}

.whatsapp-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--whatsapp-color);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

.whatsapp-button:hover {
    background: #128C7E;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.3);
}

.areas-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.area-tag {
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.area-tag.penal {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

.area-tag.adolescentes {
    background: rgba(255, 193, 7, 0.1);
    color: #d39e00;
}

.area-tag.familiar {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}

.area-tag.civil {
    background: rgba(23, 162, 184, 0.1);
    color: #17a2b8;
}

.area-tag.administrativo {
    background: rgba(108, 117, 125, 0.1);
    color: var(--gray-color);
}

.area-tag.laboral {
    background: rgba(111, 66, 193, 0.1);
    color: #6f42c1;
}

.area-tag:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.prospects-card {
    max-height: 300px;
    overflow-y: auto;
}

.prospects-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.prospect-item {
    padding: 12px;
    background: white;
    border-radius: 10px;
    border-left: 3px solid var(--primary-color);
    font-size: 12px;
}

.prospect-item .name {
    font-weight: 600;
    margin-bottom: 5px;
}

.prospect-item .case {
    color: var(--gray-color);
    margin-bottom: 5px;
}

.prospect-item .time {
    font-size: 10px;
    color: var(--gray-color);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 400px;
    max-width: 90%;
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, var(--success-color), #20c997);
    color: white;
    padding: 30px;
    text-align: center;
}

.modal-header i {
    font-size: 50px;
    margin-bottom: 15px;
}

.modal-body {
    padding: 30px;
    text-align: center;
}

.info-sent {
    margin-top: 15px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 10px;
    font-size: 14px;
    text-align: left;
}

.modal-footer {
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.modal-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-btn:hover {
    background: var(--secondary-color);
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .chat-panel {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}

@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .logo-container {
        flex-direction: column;
    }
    
    .areas-grid {
        grid-template-columns: 1fr;
    }
}

/* Animaciones */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.message {
    animation: slideIn 0.3s ease-out;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}