/* Zenith Odonto — Clinic Frontend (Sorria Design System) */

/* Layout */
.layout { display: flex; height: 100vh; }

/* Sidebar */
.sidebar { width: var(--sidebar-width); background: var(--surface); display: flex; flex-direction: column; position: fixed; height: 100vh; z-index: 100; border-right: 1px solid var(--border); }
.sidebar-logo { height: var(--topbar-height); padding: 0 var(--space-5); font-size: var(--text-md); font-weight: var(--weight-semibold); display: flex; align-items: center; gap: var(--space-2); border-bottom: 1px solid var(--border-subtle); color: var(--text-primary); }
.sidebar-nav { flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-3) var(--space-3); display: flex; flex-direction: column; gap: 2px; }
.nav-eyebrow { font-size: var(--text-2xs); font-weight: var(--weight-bold); text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--text-muted); padding: var(--space-2) var(--space-3) var(--space-1); }
.nav-divider { border-top: 1px solid var(--border-subtle); margin: var(--space-2) 0; }
.sidebar-nav a { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); color: var(--text-secondary); text-decoration: none; font-size: var(--text-sm); font-weight: var(--weight-medium); border-radius: var(--radius-md); transition: all var(--dur-fast) var(--ease-out); }
.sidebar-nav a svg { flex: none; }
.sidebar-nav a:hover { color: var(--text-primary); background: var(--surface-hover); }
.sidebar-nav a.active { color: var(--brand-text); background: var(--brand-subtle); font-weight: var(--weight-semibold); }
.sidebar-nav a.nav-locked { opacity: 0.45; cursor: pointer; pointer-events: auto; }
.sidebar-nav a.nav-locked:hover { background: none; opacity: 0.6; }
.sidebar-nav a.nav-locked svg:last-child { margin-left: auto; width: 14px; height: 14px; }
.sidebar-plan { margin: var(--space-3); padding: var(--space-3); border-radius: var(--radius-lg); background: var(--brand-subtle); border: 1px solid var(--brand-border); color: var(--brand-text); }
.sidebar-user { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border-subtle); }
.sidebar-user .name { color: var(--text-primary); font-weight: var(--weight-semibold); font-size: var(--text-sm); }
.sidebar-user .role { color: var(--text-muted); font-size: var(--text-xs); margin-top: 2px; }

/* Main */
.main { flex: 1; margin-left: var(--sidebar-width); display: flex; flex-direction: column; min-height: 100vh; }
.content { padding: var(--space-6); flex: 1; overflow-y: auto; }

/* Topbar */
.topbar { height: var(--topbar-height); flex: none; background: color-mix(in srgb, var(--surface) 80%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); padding: 0 var(--space-6); display: flex; align-items: center; gap: var(--space-4); position: sticky; top: 0; z-index: 10; }
.topbar-title h1 { margin: 0; font-size: var(--text-lg); font-weight: var(--weight-extra); letter-spacing: var(--tracking-tight); }
.topbar-subtitle { margin: 0; font-size: 12.5px; color: var(--text-muted); }
.topbar-search { display: flex; align-items: center; gap: var(--space-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0 var(--space-3); height: 36px; width: 240px; color: var(--text-muted); }
.topbar-search input { border: none; background: transparent; outline: none; font-family: var(--font-sans); font-size: var(--text-sm); color: var(--text-primary); width: 100%; }
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search kbd { font-size: 10px; font-family: var(--font-mono); color: var(--text-muted); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 1px 5px; }
.topbar-icon-btn { position: relative; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: var(--space-2); border-radius: var(--radius-md); transition: all var(--dur-fast) var(--ease-out); display: flex; align-items: center; }
.topbar-icon-btn:hover { background: var(--surface-hover); color: var(--text-primary); }
.notification-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.topbar-user { display: flex; align-items: center; gap: 9px; padding-left: var(--space-2); border-left: 1px solid var(--border); margin-left: var(--space-1); }

/* Status banner */
.status-banner { padding: var(--space-3) var(--space-6); font-size: var(--text-sm); display: flex; justify-content: space-between; align-items: center; }
.status-banner.trial { background: var(--brand-subtle); color: var(--brand-text); }
.status-banner.overdue { background: var(--warning-subtle); color: var(--warning-text); }
.status-banner.suspended { background: var(--danger-subtle); color: var(--danger-text); }
.status-banner .cta-btn { padding: var(--space-1) var(--space-4); border-radius: var(--radius-sm); border: none; cursor: pointer; font-weight: var(--weight-semibold); font-size: var(--text-sm); font-family: var(--font-sans); }
.status-banner.trial .cta-btn { background: var(--brand); color: var(--on-brand); }
.status-banner.overdue .cta-btn { background: var(--warning-text); color: var(--neutral-0); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-sm); }
.card-label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-secondary); margin-bottom: var(--space-2); }
.card-value { font-size: var(--text-3xl); font-weight: var(--weight-extra); letter-spacing: var(--tracking-tighter); color: var(--text-primary); font-variant-numeric: tabular-nums; }
.card-sub { font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--space-1); }

/* Tables */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.table-toolbar { padding: var(--space-4); display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; border-bottom: 1px solid var(--border); }
.table-toolbar input, .table-toolbar select { padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--text-sm); font-family: var(--font-sans); background: var(--surface); color: var(--text-primary); }
.table-toolbar input { flex: 1; min-width: 200px; }
.table-toolbar input::placeholder { color: var(--text-muted); }
.table-toolbar input:focus, .table-toolbar select:focus { outline: none; border-color: var(--brand); box-shadow: var(--shadow-focus); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: var(--space-3) var(--space-4); font-size: var(--text-2xs); font-weight: var(--weight-bold); color: var(--text-muted); text-transform: uppercase; letter-spacing: var(--tracking-caps); border-bottom: 1px solid var(--border); }
td { padding: var(--space-3) var(--space-4); font-size: var(--text-sm); border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
tr:hover td { background: var(--surface-hover); }
.table-empty { padding: var(--space-8); text-align: center; color: var(--text-muted); }
.pagination { padding: var(--space-3) var(--space-4); display: flex; justify-content: space-between; align-items: center; font-size: var(--text-sm); color: var(--text-muted); border-top: 1px solid var(--border); }
.pagination button { padding: var(--space-1) var(--space-3); border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); border-radius: var(--radius-sm); cursor: pointer; font-size: var(--text-sm); font-family: var(--font-sans); transition: all var(--dur-fast) var(--ease-out); }
.pagination button:hover { border-color: var(--border-strong); color: var(--text-primary); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px var(--space-2); border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: var(--weight-semibold); }
.badge-blue { background: var(--brand-subtle); color: var(--brand-text); }
.badge-green { background: var(--success-subtle); color: var(--success-text); }
.badge-yellow { background: var(--warning-subtle); color: var(--warning-text); }
.badge-red { background: var(--danger-subtle); color: var(--danger-text); }
.badge-gray { background: var(--surface-2); color: var(--text-secondary); }
.badge-purple { background: var(--ai-subtle); color: var(--ai-text); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-4); border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: var(--weight-semibold); font-family: var(--font-sans); cursor: pointer; border: none; transition: all var(--dur-fast) var(--ease-out); white-space: nowrap; }
.btn svg { flex: none; }
.btn-primary { background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-xs); }
.btn-primary:hover { background: var(--brand-hover); box-shadow: var(--shadow-sm); }
.btn-secondary { background: var(--surface); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn-danger { background: var(--danger-subtle); color: var(--danger-text); }
.btn-danger:hover { background: var(--danger); color: var(--neutral-0); }
.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); }
.btn-icon { padding: var(--space-1); border-radius: var(--radius-sm); background: none; border: none; cursor: pointer; color: var(--text-muted); transition: all var(--dur-fast) var(--ease-out); display: inline-flex; align-items: center; }
.btn-icon:hover { background: var(--surface-hover); color: var(--text-primary); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); width: 90%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-xl); }
.modal-header { padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { font-size: var(--text-lg); font-weight: var(--weight-bold); }
.modal-body { padding: var(--space-5); }
.modal-footer { padding: var(--space-3) var(--space-5); border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: var(--space-2); }

/* Forms */
.form-group { margin-bottom: var(--space-4); }
.form-group label { display: block; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-secondary); margin-bottom: var(--space-1); }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); font-size: var(--text-base); font-family: var(--font-sans); background: var(--surface); color: var(--text-primary); transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--shadow-focus); }
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-muted); }
.form-error { color: var(--danger-text); font-size: var(--text-xs); margin-top: var(--space-1); }

/* Login page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--neutral-900) 0%, var(--brand-800) 100%); }
.login-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: var(--space-8); width: 90%; max-width: 400px; box-shadow: var(--shadow-xl); }
.login-box h1 { font-size: var(--text-2xl); font-weight: var(--weight-extra); letter-spacing: var(--tracking-tighter); margin-bottom: var(--space-1); color: var(--text-primary); }
.login-box .subtitle { color: var(--text-muted); margin-bottom: var(--space-6); font-size: var(--text-base); }
.login-box .btn-primary { width: 100%; justify-content: center; padding: var(--space-3); font-size: var(--text-md); }
.login-box .toggle { text-align: center; margin-top: var(--space-4); font-size: var(--text-sm); color: var(--text-muted); }
.login-box .toggle a { color: var(--brand-text); cursor: pointer; text-decoration: none; font-weight: var(--weight-medium); }
.login-box .toggle a:hover { text-decoration: underline; }
.login-error { background: var(--danger-subtle); color: var(--danger-text); padding: var(--space-3); border-radius: var(--radius-md); font-size: var(--text-sm); margin-bottom: var(--space-4); }

/* Appointments */
.apt-list { display: flex; flex-direction: column; gap: var(--space-2); }
.apt-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4); box-shadow: var(--shadow-xs); display: flex; align-items: center; gap: var(--space-3); transition: box-shadow var(--dur-fast) var(--ease-out); }
.apt-item:hover { box-shadow: var(--shadow-sm); }
.apt-item .time { font-weight: var(--weight-bold); color: var(--brand-text); min-width: 50px; font-family: var(--font-mono); font-size: var(--text-sm); }
.apt-item .info { flex: 1; min-width: 0; }
.apt-item .patient-name { font-weight: var(--weight-semibold); color: var(--text-primary); font-size: var(--text-sm); }
.apt-item .procedure { font-size: var(--text-xs); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* CRM Kanban */
.kanban { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-3); align-items: start; }
.kanban-col { background: var(--bg-subtle); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-3); }
.kanban-col-header { display: flex; align-items: center; justify-content: space-between; }
.kanban-col-title { font-size: var(--text-sm); font-weight: var(--weight-bold); }
.kanban-col-count { font-size: var(--text-2xs); font-weight: var(--weight-bold); color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-full); padding: 1px 7px; }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-3); box-shadow: var(--shadow-xs); display: flex; flex-direction: column; gap: var(--space-2); cursor: pointer; transition: box-shadow var(--dur-fast) var(--ease-out); }
.kanban-card:hover { box-shadow: var(--shadow-md); }
.kanban-add { display: flex; align-items: center; justify-content: center; gap: var(--space-2); padding: var(--space-2); border-radius: var(--radius-md); border: 1px dashed var(--border-strong); background: transparent; color: var(--text-muted); font-size: var(--text-xs); font-weight: var(--weight-semibold); cursor: pointer; font-family: var(--font-sans); }
.kanban-add:hover { border-color: var(--brand); color: var(--brand-text); }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform var(--dur-slow) var(--ease-out); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .cards { grid-template-columns: 1fr 1fr; }
  .topbar-search { display: none; }
  .topbar-user { display: none; }
  .table-toolbar { flex-direction: column; }
  .table-toolbar input { min-width: auto; width: 100%; }
}

/* Loading */
.loading { display: flex; align-items: center; justify-content: center; padding: var(--space-8); color: var(--text-muted); }
.spinner { width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin .6s linear infinite; margin-right: var(--space-2); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast { position: fixed; bottom: var(--space-6); right: var(--space-6); padding: var(--space-3) var(--space-5); border-radius: var(--radius-lg); font-size: var(--text-sm); z-index: 2000; animation: slideIn .3s var(--ease-out); box-shadow: var(--shadow-lg); }
.toast-success { background: var(--success-subtle); color: var(--success-text); border: 1px solid var(--success); }
.toast-error { background: var(--danger-subtle); color: var(--danger-text); border: 1px solid var(--danger); }
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
