/* =========================================================
   CLINICA AI SUITE - MODERN LIGHT GLASSMORPHISM DESIGN SYSTEM
   ========================================================= */

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

:root {
  --primary: #0284C7;
  --primary-hover: #0369A1;
  --primary-gradient: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
  --secondary-gradient: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
  --accent-gradient: linear-gradient(135deg, #10B981 0%, #059669 100%);
  --ai-gradient: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%);
  
  --bg-dark: #F1F5F9;
  --bg-card: #FFFFFF;
  --bg-sidebar: #FFFFFF;
  --border-color: #E2E8F0;
  --text-main: #0F172A;
  --text-muted: #64748B;
  
  --success: #10B981;
  --warning: #D97706;
  --danger: #EF4444;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --shadow-glow: 0 4px 20px rgba(14, 165, 233, 0.15);
  --glass-backdrop: blur(16px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(at 10% 10%, rgba(14, 165, 233, 0.08) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(99, 102, 241, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6, .brand-font {
  font-family: 'Outfit', sans-serif;
  color: #0F172A;
}

/* --- APP LAYOUT STRUCTURE --- */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
  width: 260px;
  background: #1E3A5F;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 4px 0 20px rgba(30, 58, 95, 0.15);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: all 0.3s ease;
}

.sidebar-header {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  color: white;
  box-shadow: var(--shadow-glow);
}

.sidebar-title {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.2;
  color: #FFFFFF;
}

.sidebar-subtitle {
  font-size: 0.7rem;
  color: #CBD5E1;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
}

.sidebar-group {
  margin-bottom: 1.25rem;
}

.sidebar-group-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #94A3B8;
  font-weight: 700;
  padding: 0.5rem 0.75rem;
}

.sidebar-menu {
  list-style: none;
}

.sidebar-item {
  margin-bottom: 0.25rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  color: #E2E8F0;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.sidebar-link:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-link.active {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.2);
  border-left: 3px solid #38BDF8;
  font-weight: 700;
}

.sidebar-link i {
  font-size: 1.1rem;
}

.badge-count {
  margin-left: auto;
  background: #FEF3C7;
  color: #92400E;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

/* Main Content Area */
.main-wrapper {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  height: 64px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: var(--glass-backdrop);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.header-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 0.4rem 0.85rem;
  width: 300px;
}

.header-search input {
  background: transparent;
  border: none;
  outline: none;
  color: #0F172A;
  font-size: 0.85rem;
  width: 100%;
}

.header-search input::placeholder {
  color: #94A3B8;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--secondary-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.content-body {
  padding: 2rem;
  flex: 1;
}

/* --- CARDS & UI COMPONENTS --- */
.glass-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.glass-card:hover {
  border-color: rgba(14, 165, 233, 0.3);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

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

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  margin-top: 0.2rem;
  color: #0F172A;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.btn-ai {
  background: var(--ai-gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
}

.btn-secondary {
  background: #F1F5F9;
  color: #334155;
  border: 1px solid #CBD5E1;
}

.btn-secondary:hover {
  background: #E2E8F0;
  color: #0F172A;
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.custom-table th {
  padding: 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  background: #F8FAFC;
}

.custom-table td {
  padding: 1rem;
  border-bottom: 1px solid #F1F5F9;
  font-size: 0.9rem;
  color: #1E293B;
  vertical-align: middle;
}

.custom-table tr:hover td {
  background: #F8FAFC;
}

/* Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.badge-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.badge-danger { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.badge-info { background: #E0F2FE; color: #075985; border: 1px solid #BAE6FD; }

/* Forms & Inputs */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: var(--radius-md);
  color: #0F172A;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.form-control option {
  background: #FFFFFF;
  color: #0F172A;
}

/* Auth Cards (Login & Register High Contrast) */
.auth-card {
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  color: #F8FAFC;
}

.auth-card h2 {
  color: #F8FAFC !important;
}

.auth-card p {
  color: #94A3B8 !important;
}

.auth-card .form-group label {
  color: #E2E8F0 !important;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.4rem;
  display: block;
}

.auth-card .form-control {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  color: #FFFFFF !important;
  font-size: 0.925rem;
  border-radius: 8px;
}

.auth-card .form-control::placeholder {
  color: #94A3B8 !important;
  opacity: 1;
}

.auth-card .form-control:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25) !important;
  background: rgba(255, 255, 255, 0.12) !important;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  overflow-y: auto;
  padding: 2rem 1rem;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 550px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 1.75rem 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  transform: scale(0.95);
  transition: transform 0.2s ease;
  margin: auto;
  color: #0F172A;
}

.modal-box form {
  overflow-y: auto;
  max-height: 100%;
  padding-right: 0.35rem;
}

.modal-overlay.active .modal-box {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.85rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
}

/* Grid & Responsive Utilities */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 200;
}

.toast {
  background: #FFFFFF;
  border: 1px solid var(--primary);
  color: #0F172A;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
  animation: slideIn 0.3s ease;
  font-weight: 500;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Calendar Styles */
.cal-hour-slot {
  display: flex;
  align-items: flex-start;
  padding: 0.5rem 0;
  border-bottom: 1px solid #E2E8F0;
}

.cal-card-event {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #0F172A;
}

.cal-card-event:hover {
  background: #F1F5F9;
  transform: translateX(2px);
}

.btn-view {
  background: transparent;
  color: #64748B;
  border: none;
}

.btn-view.active {
  background: var(--primary);
  color: white;
  font-weight: 600;
}
