/* ============================================
   Dashboard - Dra. Victória Márcia
   ============================================ */

:root {
  --color-primary: #003B5C;
  --color-primary-dark: #002a42;
  --color-secondary: #00A8E8;
  --color-cyan: #00D4FF;
  --color-white: #ffffff;
  --color-slate-50: #f8fafc;
  --color-slate-100: #f1f5f9;
  --color-slate-200: #e2e8f0;
  --color-slate-300: #cbd5e1;
  --color-slate-400: #94a3b8;
  --color-slate-500: #64748b;
  --color-slate-600: #475569;
  --color-slate-700: #334155;
  --color-slate-800: #1e293b;
  --color-slate-900: #0f172a;
  
  --font-sans: 'Inter', sans-serif;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --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);
  
  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;
}

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

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-slate-700);
  background: var(--color-slate-50);
}

/* ============================================
   LOGIN SCREEN
   ============================================ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  padding: 1.5rem;
}

.login-card {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 450px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-logo img {
  height: 48px;
  width: auto;
}

.login-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
  text-align: center;
  margin-bottom: 0.5rem;
}

.login-card > p {
  text-align: center;
  color: var(--color-slate-500);
  margin-bottom: 1.5rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-slate-700);
}

.form-input,
.form-select {
  min-height: 52px;
  padding: 0.95rem 1rem;
  border: 1px solid var(--color-slate-200);
  border-radius: 0.95rem;
  font-size: 0.875rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
  transition: all 0.3s;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: rgba(0, 168, 232, 0.6);
  box-shadow: 0 0 0 4px rgba(0, 168, 232, 0.1);
}

.login-error {
  color: #ef4444;
  font-size: 0.875rem;
  text-align: center;
  margin-top: 1rem;
  min-height: 1.25rem;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  background: linear-gradient(to right, var(--color-primary), var(--color-secondary));
  color: var(--color-white);
}

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--color-slate-200);
  color: var(--color-slate-600);
}

.btn-outline:hover {
  background: var(--color-slate-50);
  border-color: var(--color-slate-300);
}

.btn-logout-header {
  background: linear-gradient(135deg, var(--color-slate-700) 0%, var(--color-slate-900) 100%);
  color: var(--color-white);
}

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

.btn-text {
  background: transparent;
  color: var(--color-secondary);
  padding: 0;
}

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

.btn-sm {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-full {
  width: 100%;
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */
.dashboard {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--color-white);
  border-right: 1px solid var(--color-slate-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--color-slate-100);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-header img {
  height: 40px;
  width: auto;
}

.sidebar-header span {
  font-weight: 600;
  color: var(--color-primary);
  text-align: center;
}

.sidebar-user-panel {
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid var(--color-slate-100);
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow-y: auto;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  color: var(--color-slate-600);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: color 0.5s;
}

.nav-item::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(to right, var(--color-primary), var(--color-secondary));
  border-radius: 1px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s;
}

.nav-item:hover {
  color: var(--color-primary);
}

.nav-item.active {
  color: var(--color-primary);
}

.nav-item:hover::after,
.nav-item.active::after {
  transform: scaleX(1);
}

.nav-item svg {
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--color-slate-100);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.user-info-top {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.9rem;
  margin-bottom: 0;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(to right, var(--color-primary), var(--color-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  font-weight: 600;
  font-size: 0.875rem;
}

.user-info-top .user-avatar {
  width: 72px;
  height: 72px;
  font-size: 1.5rem;
  box-shadow: var(--shadow-md);
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-info-top .user-details {
  align-items: center;
  gap: 0.2rem;
}

.user-name {
  font-weight: 500;
  color: var(--color-slate-800);
  font-size: 0.875rem;
}

.user-info-top .user-name {
  font-size: 1rem;
  font-weight: 600;
}

.user-role {
  font-size: 0.75rem;
  color: var(--color-slate-400);
}

.user-info-top .user-role {
  font-size: 0.8rem;
}

.sidebar-credits {
  display: inline-flex;
  justify-content: center;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 1.5rem;
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.content-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
}

.header-actions {
  display: flex;
  gap: 0.75rem;
}

/* ============================================
   PAGES
   ============================================ */
.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn 0.3s;
}

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

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.blue {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.stat-icon.green {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.stat-icon.purple {
  background: rgba(168, 85, 247, 0.1);
  color: #a855f7;
}

.stat-icon.orange {
  background: rgba(249, 115, 22, 0.1);
  color: #f97316;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-slate-800);
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--color-slate-500);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

/* Dashboard Card */
.dashboard-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem;
  border-bottom: 1px solid var(--color-slate-100);
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-slate-800);
}

.appointments-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

#btn-appointments-report {
  min-height: 52px;
}

.header-filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.header-filters .form-input,
.header-filters .form-select {
  width: auto;
  min-width: 150px;
}

/* Appointments List */
.appointments-list {
  padding: 0.75rem;
}

.appointment-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem;
  border-radius: var(--radius);
  transition: background 0.3s;
}

.appointment-item:hover {
  background: var(--color-slate-50);
}

.appointment-item + .appointment-item {
  border-top: 1px solid var(--color-slate-100);
}

.appointment-time {
  width: 60px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-primary);
}

.appointment-info {
  flex: 1;
  min-width: 0;
}

.appointment-patient {
  font-weight: 500;
  color: var(--color-slate-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appointment-service {
  font-size: 0.8125rem;
  color: var(--color-slate-500);
}

.appointment-professional {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--color-slate-600);
}

.professional-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
}

.appointment-status {
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
}

.status-confirmed {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}

.status-completed {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}

.status-cancelled {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

/* Table */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 0.875rem 1.25rem;
  text-align: left;
  font-size: 0.875rem;
}

.data-table th {
  font-weight: 600;
  color: var(--color-slate-500);
  background: var(--color-slate-50);
  border-bottom: 1px solid var(--color-slate-200);
}

.data-table td {
  border-bottom: 1px solid var(--color-slate-100);
  color: var(--color-slate-700);
}

.data-table tr:hover td {
  background: var(--color-slate-50);
}

/* Professionals Grid */
.professionals-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding: 1.25rem;
}

.professional-card {
  background: var(--color-slate-50);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  transition: all 0.3s;
}

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

.professional-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-white);
}

.professional-card h4 {
  font-weight: 600;
  color: var(--color-slate-800);
  margin-bottom: 0.25rem;
}

.professional-card p {
  font-size: 0.8125rem;
  color: var(--color-slate-500);
  margin-bottom: 1rem;
}

.professional-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

/* Schedule Config */
.schedule-config {
  padding: 1.25rem;
}

.schedule-day {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--color-slate-100);
}

.schedule-day:last-child {
  border-bottom: none;
}

.schedule-day-name {
  width: 100px;
  font-weight: 500;
  color: var(--color-slate-700);
}

.schedule-slots {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.schedule-slot {
  padding: 0.375rem 0.75rem;
  background: var(--color-slate-100);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  color: var(--color-slate-600);
}

/* Messages */
.messages-list {
  padding: 0.75rem;
}

.message-item {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  border-radius: var(--radius);
  transition: background 0.3s;
}

.message-item:hover {
  background: var(--color-slate-50);
}

.message-item + .message-item {
  border-top: 1px solid var(--color-slate-100);
}

.message-item.unread {
  background: rgba(0, 168, 232, 0.05);
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: linear-gradient(to right, var(--color-primary), var(--color-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  font-weight: 600;
  flex-shrink: 0;
}

.message-content {
  flex: 1;
  min-width: 0;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.message-name {
  font-weight: 500;
  color: var(--color-slate-800);
}

.message-date {
  font-size: 0.75rem;
  color: var(--color-slate-400);
}

.message-text {
  font-size: 0.875rem;
  color: var(--color-slate-600);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-contact {
  font-size: 0.75rem;
  color: var(--color-slate-400);
  margin-top: 0.25rem;
}

.text-center {
  text-align: center;
}

.py-4 {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.text-slate-400 {
  color: var(--color-slate-400);
}

.form-help {
  font-size: 0.75rem;
  color: var(--color-slate-400);
}

.dashboard-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 300;
}

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

.dashboard-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.dashboard-modal-card {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
}

.dashboard-modal-card-sm {
  width: min(100%, 520px);
}

.dashboard-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-slate-500);
  transition: all 0.3s;
}

.dashboard-modal-close:hover {
  background: var(--color-slate-50);
  color: var(--color-primary);
}

.dashboard-modal-header {
  margin-bottom: 1.25rem;
  padding-right: 2.5rem;
}

.dashboard-modal-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.35rem;
}

.dashboard-modal-header p {
  color: var(--color-slate-500);
  font-size: 0.9rem;
}

.dashboard-modal-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.system-dialog-textarea {
  resize: vertical;
  min-height: 120px;
}

.modal-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.dashboard-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .professionals-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    height: auto;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--color-slate-200);
    z-index: 100;
  }
  
  .sidebar-header,
  .sidebar-user-panel,
  .sidebar-footer {
    display: none;
  }
  
  .sidebar-nav {
    flex-direction: row;
    justify-content: space-around;
    padding: 0.5rem;
  }
  
  .nav-item {
    flex-direction: column;
    padding: 0.5rem;
    font-size: 0.625rem;
    letter-spacing: 0;
  }
  
  .nav-item::after {
    left: 0.25rem;
    right: 0.25rem;
  }
  
  .main-content {
    margin-left: 0;
    padding-bottom: 80px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .professionals-grid {
    grid-template-columns: 1fr;
  }
  
  .appointments-toolbar {
    width: 100%;
    justify-content: stretch;
  }

  .header-filters {
    flex-direction: column;
    width: 100%;
  }

  #btn-appointments-report {
    width: 100%;
  }

  .modal-form-grid {
    grid-template-columns: 1fr;
  }
}

.login-card .form-input {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

.login-card .btn-primary {
  min-height: 52px;
}

.login-credits {
  margin-top: 1.35rem;
  width: 100%;
  justify-content: center;
}

.credits-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: rgba(51, 65, 85, 0.58);
  text-decoration: none;
  transition: all 0.5s;
}

.credits-link:hover {
  color: var(--color-primary);
}

.credits-link strong {
  font-weight: 600;
}

.credits-link svg:last-child {
  opacity: 0;
  transition: opacity 0.3s;
}

.credits-link:hover svg:last-child {
  opacity: 1;
}

.login-form .form-input {
  min-height: 56px;
  padding: 1rem 1rem;
  border-radius: 1rem;
}

@media (max-width: 768px) {
  .sidebar-credits {
    display: none;
  }
}
