/* css/main.css */
:root {
    /* Color Palette */
    --color-primary: #C59F9A;
    --color-primary-hover: #B08984;
    --color-primary-strong: #A67A74;
    --color-on-primary: #ffffff;
    --color-secondary: #f3f4f6;
    --color-secondary-hover: #e5e7eb;
    --color-background: #f9fafb;
    --color-surface: #ffffff;
    
    --color-text: #1f2937;
    --color-text-muted: #6b7280;
    --color-border: #e5e7eb;
    
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-warning-light: #fef3c7;
    --color-danger: #ef4444;
    
    /* Typography */
    --font-family: 'Inter', sans-serif;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    
    /* Borders & Shadows */
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--color-background);
    color: var(--color-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
#app {
    display: flex;
    min-height: 100vh;
}

#sidebar {
    width: 250px;
    background-color: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
}

.logo {
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--color-border);
}

.logo img {
    display: block;
    width: 100%;
    max-width: 210px;
    height: auto;
}

.nav-links {
    list-style: none;
    padding: var(--space-md) 0;
    flex: 1;
}

body.role-doctor .admin-only {
    display: none !important;
}

.sidebar-user {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--color-border);
}

.sidebar-user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-user-meta strong {
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user-meta span {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.sidebar-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--color-text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
}

.sidebar-logout:hover {
    color: var(--color-primary);
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    color: var(--color-text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-links li a:hover, .nav-links li a.active {
    background-color: var(--color-secondary);
    color: var(--color-primary);
    border-right: 3px solid var(--color-primary);
}

#main-content {
    flex: 1;
    padding: var(--space-xl);
    overflow-y: auto;
    background-color: var(--color-background);
}

/* Views */
.view {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.view.active-view {
    display: block;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
}

.view-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
}

/* Utilities */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }
.mb-md { margin-bottom: var(--space-md); }
.mt-md { margin-top: var(--space-md); }
.mt-sm { margin-top: var(--space-sm); }
.bg-gray { background-color: var(--color-secondary) !important; }
.bg-warning-light { background-color: var(--color-warning-light) !important; border: 1px solid var(--color-warning); }
.text-muted { color: var(--color-text-muted); }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
    #app { flex-direction: column; }
    #sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--color-border); }
    .logo { padding: var(--space-sm) var(--space-md); justify-content: flex-start; border-bottom: none; }
    .logo img { max-width: 160px; }
    .nav-links { display: flex; overflow-x: auto; padding: 0; }
    .nav-links li a { padding: var(--space-sm) var(--space-md); border-right: none; border-bottom: 2px solid transparent; }
    .nav-links li a.active { border-bottom: 2px solid var(--color-primary); }
    .sidebar-user { padding: var(--space-sm) var(--space-md); }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* Verifactu Tabs */
.tabs-container {
    margin-top: var(--space-md);
}

.tabs-header {
    display: flex;
    gap: var(--space-sm);
    border-bottom: 2px solid var(--color-border);
    margin-bottom: var(--space-md);
}

.tab-btn {
    padding: var(--space-md) var(--space-lg);
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 600;
    color: var(--color-text-muted);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--color-primary);
}

.tab-btn.active {
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

/* Status Badges Extension */
.badge-simulacion { background-color: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.badge-aceptada { background-color: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge-rechazada { background-color: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-pendiente { background-color: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

.audit-logs-pre {
    scrollbar-width: thin;
    scrollbar-color: var(--color-text-muted) var(--color-secondary);
}

.audit-logs-pre::-webkit-scrollbar {
    width: 6px;
}

.audit-logs-pre::-webkit-scrollbar-thumb {
    background-color: var(--color-text-muted);
    border-radius: 10px;
}

.user-color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0.15rem 0 0.35rem;
}

.user-color-option {
    width: 1.85rem;
    height: 1.85rem;
    padding: 0;
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.user-color-option:hover {
    transform: scale(1.06);
}

.user-color-option.is-selected {
    border-color: var(--color-primary-strong);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 45%, white);
}

.user-color-swatch {
    display: inline-block;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    vertical-align: middle;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
