/* Modern Design System - Inspired by Analytics Dashboard */
:root {
    /* Dark Theme Colors */
    --primary-dark: #1e1f2e;
    --primary-darker: #16172a;
    --sidebar-bg: #2a2d47;
    --sidebar-item: #3a3f5c;
    --sidebar-active: #4f46e5;
    --accent-teal: #0d9488;
    --accent-blue: #3b82f6;
    
    /* Light Theme Colors */
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    
    /* Status Colors */
    --success-green: #10b981;
    --warning-orange: #f59e0b;
    --error-red: #ef4444;
    --info-blue: #3b82f6;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--sidebar-bg) 0%, var(--primary-darker) 100%);
    --gradient-accent: linear-gradient(135deg, var(--accent-teal) 0%, var(--accent-blue) 100%);
    --gradient-light: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

/* Global Styles */
* {
    box-sizing: border-box;
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    height: 100%;
}

.x-small {
    font-size: x-small !important;
}

/* Main Layout Structure */
.consultorio-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar Styles */
.sidebar {
    height: 100vh;
    position: relative;
    z-index: 1; 
}

.sidebar-header {
    padding: 0.5rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    text-decoration: none;
}

.sidebar-brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.025em;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0;
    overflow-y: auto;
}

.sidebar-nav-item {
    display: block;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-weight: 500;
}

.sidebar-nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: var(--accent-teal);
}

.sidebar-nav-item.active {
    background: rgba(79, 70, 229, 0.2);
    color: white;
    border-left-color: var(--sidebar-active);
}

.sidebar-nav-item i {
    width: 20px;
    margin-right: 0.75rem;
}

.sidebar-footer{
    margin:5px;
}

/* Compact Sidebar Styles */
.compact-sidebar {
    padding: 0;
    background: var(--sidebar-bg, #222);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.compact-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    margin-top: 1rem;
}

.compact-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0;
    width: 100%;
    text-align: center;
    color: var(--sidebar-text, #fff);
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.2s;
}

    .compact-nav-item .icon {
        font-size: 1.5rem;
        margin-bottom: 0.2rem;
        margin-left: 0.8rem;
    }

.compact-nav-item .label {
    font-size: 0.7rem;
    line-height: 1;
    margin-top: 0;
    color: var(--sidebar-label, #ccc);
}

.compact-nav-item.active,
.compact-nav-item:hover {
    background: var(--sidebar-active-bg, #333);
    color: var(--sidebar-active-text, #fff);
}

/* Header Styles */
.header {
    background: white;
    box-shadow: var(--shadow-sm);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 9999;
    border-bottom: 1px solid var(--border-light);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: between;
    padding: 1rem 2rem;
    gap: 1rem;
}

.header-tabs {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex: 1;
}

.header-tab {
    padding: 0.75rem 1.5rem;
    background: var(--bg-light);
    border: none;
    border-radius: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-tab:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.header-tab.active {
    background: var(--gradient-accent);
    color: white;
    box-shadow: var(--shadow-md);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Main Content */
.main-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #fff;
    height: 100vh;
    overflow: auto;
}

.content-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.025em;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin: 0;
}

/* Cards */
.card {
    background: white;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background: var(--bg-light);
    border-top: 1px solid var(--border-light);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: var(--gradient-accent);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
    color: white;
}

.btn-success {
    background: var(--success-green);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
    color: white;
}

.btn-outline-light {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

/* Forms */
.form-control {
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-medium);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-teal);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-select {
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-medium);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: white;
}

/* Badges and Status */
.badge {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-green);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-orange);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info-blue);
}

/* Patient Cards */
.paciente-card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.paciente-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-accent);
}

.paciente-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--accent-teal);
}

.avatar-circle {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--gradient-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.patient-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.patient-age {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.info-item i {
    width: 16px;
    color: var(--accent-teal);
}

/* Modal Styles */
.modal {
    background: rgba(30, 31, 46, 0.5);
    backdrop-filter: blur(8px);
}

.modal-content {
    border: none;
    border-radius: 1rem;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
    background: var(--bg-light);
}

/* Utility Classes */
.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success-green) !important; }
.text-warning { color: var(--warning-orange) !important; }
.text-danger { color: var(--error-red) !important; }

.bg-light { background: var(--bg-light) !important; }
.bg-white { background: var(--bg-white) !important; }

/* Loading Animation */
.loading-progress {
    position: relative;
    display: block;
    width: 40px;
    height: 40px;
}

.loading-progress circle {
    fill: none;
    stroke: var(--border-light);
    stroke-width: 5px;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--accent-teal);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: 600;
    color: var(--accent-teal);
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

/* Error UI */
#blazor-error-ui {
    background: white;
    bottom: 0;
    box-shadow: var(--shadow-lg);
    display: none;
    left: 0;
    padding: 1rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    border-top: 3px solid var(--error-red);
}

/* Responsive Design */
@media (max-width: 1024px) {
    /* .sidebar {
        transform: translateX(-100%);
    } */

    .main-content {
        margin-left: 0;
    }

    .content-container {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 1rem;
    }
    
    .header-tabs {
        gap: 1rem;
    }
    
    .header-tab {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .page-subtitle {
        font-size: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Focus States */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--accent-teal);
    outline-offset: 2px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}