/* MSAL (Ministerio de Salud) Institutional Light/Clean Theme */
@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400..700;1,400..700&family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');

:root {
    --bg-gradient: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    --panel-bg: #ffffff;
    --panel-border: rgba(36, 44, 79, 0.08);
    --accent-color: #242c4f;
    --accent-gradient: linear-gradient(135deg, #242c4f 0%, #3a4574 100%);
    --accent-hover: #50535c;
    --text-primary: #1e293b;
    --text-secondary: #50535c;
    --success-color: #10b981;
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --card-shadow: 0 10px 30px -10px rgba(36, 44, 79, 0.08);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Montserrat', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, .navbar-brand, .nav-link, .form-label {
    font-family: "Lora", serif;
}

/* Glassmorphism/Institutional white panels */
.glass-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
}

.glass-panel:hover {
    border-color: rgba(36, 44, 79, 0.15);
    box-shadow: 0 12px 36px -8px rgba(36, 44, 79, 0.12);
}

/* Navbar */
nav.navbar {
    border-bottom: 3px solid #50535c;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #242c4f;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #ffffff !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 1rem;
    list-style: none;
    align-items: center;
}

.nav-link {
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
    color: #ffffff;
    background: #50535c;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Buttons */
.btn-primary {
    background: var(--accent-gradient);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(36, 44, 79, 0.2);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
}

.btn-primary:hover {
    transform: translateY(-1px);
    background: #50535c;
    box-shadow: 0 6px 16px rgba(36, 44, 79, 0.3);
}

.btn-secondary {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.btn-success {
    background: var(--success-gradient);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

/* Dashboard Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(36, 44, 79, 0.05);
}

.stat-icon.primary { color: #242c4f; background: rgba(36, 44, 79, 0.1); }
.stat-icon.success { color: #10b981; background: rgba(16, 185, 129, 0.1); }
.stat-icon.warning { color: #f59e0b; background: rgba(245, 158, 11, 0.1); }
.stat-icon.danger { color: #ef4444; background: rgba(239, 68, 68, 0.1); }

.stat-details h3 {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.25rem;
}

.stat-details .value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #242c4f;
}

/* Tables */
table.custom-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

table.custom-table th, table.custom-table td {
    padding: 1rem 1.25rem;
    text-align: left;
}

table.custom-table th {
    background: #f8fafc;
    color: #334155;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #cbd5e1;
}

table.custom-table td {
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
    color: #334155;
}

table.custom-table tbody tr:hover {
    background: #f8fafc;
}

/* Badges */
.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    text-transform: uppercase;
}

.badge-active { background: rgba(36, 44, 79, 0.1); color: #242c4f; border: 1px solid rgba(36, 44, 79, 0.2); }
.badge-solved { background: rgba(16, 185, 129, 0.1); color: #059669; border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-pending { background: rgba(245, 158, 11, 0.1); color: #d97706; border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-created { background: rgba(59, 130, 246, 0.1); color: #2563eb; border: 1px solid rgba(59, 130, 246, 0.2); }

/* Live WhatsApp Conversation Styling */
.chat-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1.5rem;
    height: calc(100vh - 140px);
}

.chat-sidebar {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    border-radius: 12px;
}

.chat-sessions-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
}

.session-item {
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.session-item:hover {
    background: #f1f5f9;
}

.session-item.active {
    background: rgba(36, 44, 79, 0.05);
    border-color: #242c4f;
}

.chat-window {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.chat-header {
    padding: 1rem 1.5rem;
    border-bottom: 2px solid #cbd5e1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #ffffff;
}

.message-bubble {
    max-width: 65%;
    padding: 0.85rem 1.15rem;
    border-radius: 12px;
    line-height: 1.4;
    font-size: 0.95rem;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    font-family: 'Montserrat', sans-serif;
}

.message-bubble.inbound {
    align-self: flex-start;
    background: #f1f5f9;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    border: 1px solid #e2e8f0;
}

.message-bubble.outbound {
    align-self: flex-end;
    background: #242c4f;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 0.7rem;
    color: #64748b;
    text-align: right;
    margin-top: 0.35rem;
}

.message-bubble.outbound .message-time {
    color: #94a3b8;
}

.chat-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    gap: 1rem;
    background: #f8fafc;
}

.chat-placeholder i {
    font-size: 3.5rem;
    color: #242c4f;
}

/* Forms and Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0.85rem 1.15rem;
    color: #1e293b;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: #242c4f;
    box-shadow: 0 0 0 3px rgba(36, 44, 79, 0.15);
}

/* Simulator Chat Window */
.simulator-container {
    max-width: 500px;
    margin: 2rem auto;
    height: 600px;
    display: flex;
    flex-direction: column;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: var(--card-shadow);
}

.simulator-input-area {
    padding: 1rem;
    border-top: 2px solid #cbd5e1;
    display: flex;
    gap: 0.75rem;
    background: #f8fafc;
}

/* Utility Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
