/* ===================================================
   NEXORA-Med - Professional Medical CRM Stylesheet
   Font: Roboto | Dark Futuristic Sidebar | Modern Light Workspace
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;0,900;1,400&display=swap');
@import url('https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css');

:root {
    /* Brand Colors */
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-light: #e0f2fe;
    --accent: #00d2ff;
    
    /* Sidebar (Dark Theme) */
    --sidebar-bg: #0f172a;
    --sidebar-border: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-text-hover: #f8fafc;
    --sidebar-active-bg: rgba(14, 165, 233, 0.12);
    --sidebar-active-text: #38bdf8;
    --sidebar-active-border: #38bdf8;
    
    /* Workspace Area (Clean Light Theme) */
    --app-bg: #f8fafc;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
    --card-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    
    /* Text */
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Borders & Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;
}

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

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--app-bg);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ===================================================
   Utilerías & Controles
   =================================================== */
.hidden { display: none !important; }

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    box-shadow: 0 4px 8px rgba(2, 132, 199, 0.35);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-outline {
    background: #ffffff;
    border: 1px solid var(--card-border);
    color: var(--text-main);
}

.btn-outline:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: var(--primary);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

/* Formularios */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}

.form-control,
input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    color: var(--text-main);
    background: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
}

.form-control:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.error-msg {
    color: var(--danger);
    font-size: 12px;
    margin-top: 6px;
    font-weight: 500;
}

.empty-state {
    text-align: center;
    padding: 35px 20px;
    color: var(--text-muted);
    font-size: 13px;
    background: #ffffff;
    border-radius: var(--radius-md);
    border: 1px dashed var(--card-border);
}

/* ===================================================
   VISTA: LOGIN
   =================================================== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: radial-gradient(circle at top, #1e293b 0%, #0f172a 100%);
}

.login-box {
    background: #ffffff;
    padding: 35px 30px;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.login-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 12px;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.login-box h1 {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.5px;
}

.login-box h1 span {
    color: var(--primary);
}

.login-box p {
    color: var(--text-muted);
    margin-bottom: 22px;
    font-size: 13px;
}

.login-box button {
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    font-size: 14px;
}

/* ===================================================
   LAYOUT: APLICACIÓN PRINCIPAL
   =================================================== */
.layout-app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* SIDEBAR MODERNO OSCURO */
.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.4);
}

.brand-text {
    font-size: 17px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.3px;
}

.brand-text span {
    color: var(--accent);
}

.sidebar-nav {
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease-in-out;
}

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

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--sidebar-text-hover);
}

.nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
    border-left: 3px solid var(--sidebar-active-border);
}

.nav-item.active i {
    color: var(--accent);
}

/* ===================================================
   MAIN WRAPPER & HEADER
   =================================================== */
.main-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: var(--app-bg);
}

.topbar {
    height: 56px;
    min-height: 56px;
    background: #ffffff;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.topbar-left h3 {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    font-size: 13px;
    color: var(--text-muted);
}

.user-info strong {
    color: var(--text-main);
}

#logout-btn {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

/* ===================================================
   ÁREA DE CONTENIDO & CARDS
   =================================================== */
.content-area {
    padding: 24px;
    flex-grow: 1;
    overflow-y: auto;
}

.page {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.page-full {
    padding: 0;
    height: calc(100vh - 56px);
}

.card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
}

.card h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #0f172a;
}

/* Dashboard KPIs */
.dashboard-kpi-card {
    background: #ffffff;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-top: 3px solid var(--primary);
}

.dashboard-kpi-card span {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dashboard-kpi-card strong {
    font-size: 26px;
    font-weight: 700;
    color: #0f172a;
}

/* Tablas Modernas */
.table-container {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--card-border);
}

.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13.5px;
    color: var(--text-main);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

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

/* ===================================================
   VISTA: CONVERSACIONES & CHAT
   =================================================== */
.chat-layout {
    display: flex;
    height: 100%;
    background: var(--card-bg);
}

.chat-sidebar {
    width: 320px;
    min-width: 320px;
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

.chat-search {
    padding: 12px 16px;
    border-bottom: 1px solid var(--card-border);
    background: #ffffff;
}

.chat-search input {
    width: 100%;
    padding: 8px 14px;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-full);
    font-size: 13px;
    background: #f8fafc;
}

.chat-list {
    flex-grow: 1;
    overflow-y: auto;
}

.chat-item {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.15s ease;
}

.chat-item:hover {
    background: #f8fafc;
}

.chat-item.active {
    background: #f0f9ff;
    border-left: 4px solid var(--primary);
}

.chat-item strong {
    font-size: 13.5px;
    color: var(--text-main);
}

.chat-item small {
    color: var(--text-muted);
    font-size: 12px;
}

.chat-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: #f1f5f9;
}

.chat-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--card-border);
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header strong {
    font-size: 15px;
    color: #0f172a;
}

.chat-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    background: #e2e8f0 url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%2394a3b8' fill-opacity='0.08' fill-rule='evenodd'%3E%3Cpath d='M0 40L40 0H20L0 20M40 40V20L20 40'/%3E%3C/g%3E%3C/svg%3E");
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.msg-bubble {
    max-width: 68%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    line-height: 1.45;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.msg-in {
    align-self: flex-start;
    background: #ffffff;
    border-top-left-radius: 2px;
    color: #1e293b;
}

.msg-out {
    align-self: flex-end;
    background: #dcfce7;
    border-top-right-radius: 2px;
    color: #065f46;
}

.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--card-border);
    display: flex;
    gap: 10px;
    background: #ffffff;
}

.chat-input-area input {
    flex-grow: 1;
    padding: 9px 16px;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-full);
    background: #f8fafc;
}

.chat-info {
    width: 300px;
    min-width: 300px;
    border-left: 1px solid var(--card-border);
    padding: 18px;
    overflow-y: auto;
    background: #ffffff;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #ffffff;
    padding: 28px;
    border-radius: var(--radius-lg);
    width: 440px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.modal-content h2 {
    margin-bottom: 18px;
    font-size: 17px;
    color: #0f172a;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}
