/* =============================================
 * Molaris - Sistema de Gestión Odontológica
 * Estilos principales
 * ============================================= */

/* === Google Fonts === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700&display=swap');

/* === Variables CSS === */
:root {
    --primary: #0ea5e9;
    --primary-light: #38bdf8;
    --primary-dark: #0284c7;
    --brand-font: 'Outfit', sans-serif;
    --secondary: #06b6d4;
    --secondary-light: #22d3ee;
    --accent: #10b981;
    --accent-light: #34d399;
    --success: #059669;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;

    --bg-body: #f0f4f8;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;
    --bg-card: #ffffff;
    --bg-header: #ffffff;

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --text-sidebar: #cbd5e1;
    --text-white: #ffffff;

    --border-color: #e2e8f0;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --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);

    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 64px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Reset & Base === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* === Login Page === */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, #0f172a, #1e3a5f), 
                radial-gradient(circle at bottom right, #2563eb, #0ea5e9);
    background-blend-mode: multiply;
    padding: 24px;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 440px;
    padding: 48px;
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-logo {
    text-align: center;
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-logo img {
    width: 110px;
    height: 110px;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
    transition: transform 0.3s ease;
}

.login-logo img:hover {
    transform: scale(1.05);
}

.login-logo h1 {
    font-size: 2.25rem;
    font-weight: 700;
    font-family: var(--brand-font);
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    max-width: 240px;
    line-height: 1.4;
}

/* === Layout === */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* === Sidebar === */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1040;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    min-height: var(--header-height);
}

.sidebar-brand img {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-brand h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 0;
    line-height: 1.2;
}

.sidebar-brand small {
    font-size: 0.7rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-section-title {
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.nav-section-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-light);
    padding: 16px 20px 6px;
    opacity: 0.6;
    font-weight: 600;
}

.nav-item {
    margin: 2px 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-sidebar);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    font-size: 0.875rem;
    font-weight: 400;
    white-space: nowrap;
}

.nav-link i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.nav-link:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-white);
    transform: translateX(3px);
}

.nav-link.active {
    background: var(--primary);
    color: var(--text-white);
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-sidebar);
    font-size: 0.85rem;
}

.sidebar-user .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-white);
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* === Main Content === */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* === Top Header === */
.top-header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-toggle-sidebar {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.btn-toggle-sidebar:hover {
    background: var(--bg-body);
    color: var(--text-primary);
}

.page-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* === Content Area === */
.content-area {
    flex: 1;
    padding: 24px;
}

/* === Cards === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 20px;
}

/* === Stat Cards === */
.stat-card {
    border: none;
    border-radius: var(--border-radius);
    padding: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.stat-card.primary::before { background: var(--primary); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.info::before { background: var(--info); }

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--text-white);
}

.stat-icon.primary { background: linear-gradient(135deg, var(--primary), var(--primary-light)); }
.stat-icon.success { background: linear-gradient(135deg, var(--success), var(--accent-light)); }
.stat-icon.warning { background: linear-gradient(135deg, var(--warning), #fbbf24); }
.stat-icon.info { background: linear-gradient(135deg, var(--info), var(--secondary-light)); }

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-top: 12px;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* === Forms === */
.form-control,
.form-select {
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    font-size: 0.875rem;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

/* === Buttons === */
.btn {
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 8px 18px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* === Tables === */
.table {
    font-size: 0.875rem;
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    border-bottom-width: 2px;
}

.table td {
    vertical-align: middle;
    padding: 12px;
}

/* DataTables overrides */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* === Modals === */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
}

.modal-title {
    font-weight: 600;
    font-size: 1.05rem;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 12px 20px;
}

/* === Badges === */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 50px;
}

/* === Breadcrumb === */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 16px;
    font-size: 0.85rem;
}

.breadcrumb-item a {
    color: var(--text-secondary);
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* === Animations === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

.fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

/* === Responsive: Tablets === */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1035;
    }

    .sidebar.show ~ .sidebar-overlay {
        display: block;
    }

    .content-area {
        padding: 16px;
    }
}

@media (max-width: 768px) {
    .stat-value {
        font-size: 1.4rem;
    }

    .top-header {
        padding: 0 16px;
    }

    .page-title {
        font-size: 1rem;
    }
}

/* === Print === */
@media print {
    .sidebar,
    .top-header,
    .btn,
    .sidebar-overlay {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }
}

/* === SweetAlert custom === */
.swal2-popup {
    border-radius: var(--border-radius) !important;
    font-family: 'Inter', sans-serif !important;
}

/* === FullCalendar custom === */
.fc .fc-toolbar-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.fc .fc-button {
    border-radius: var(--border-radius-sm) !important;
    font-size: 0.85rem !important;
}

.fc .fc-button-primary {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
}

.fc .fc-button-primary:hover {
    background: var(--primary-dark) !important;
}

.fc .fc-event {
    border-radius: 4px;
    font-size: 0.8rem;
    padding: 2px 6px;
    cursor: pointer;
}

.fc .fc-daygrid-day:hover {
    background: rgba(37, 99, 235, 0.04);
}

/* === Loading spinner === */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* === Quick Action Cards === */
.quick-action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: var(--border-radius-sm);
    background: var(--bg-body);
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid transparent;
}

.quick-action:hover {
    background: var(--bg-card);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.quick-action i {
    font-size: 1.4rem;
    color: var(--primary);
}

/* === Patient profile === */
.patient-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--text-white);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    padding: 24px;
}

.patient-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--text-white);
    font-weight: 700;
}

/* === Timeline === */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--bg-card);
}

.timeline-item .timeline-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.timeline-item .timeline-content {
    background: var(--bg-body);
    border-radius: var(--border-radius-sm);
    padding: 12px 16px;
    margin-top: 6px;
}
