/**
 * Doctors List Page - Design & Layout Fixes
 * 
 * This file fixes layout alignment, spacing, visual hierarchy, and responsiveness
 * for the doctors list page while respecting existing design tokens.
 */

/* ============================================
   Main Container & Page Structure
   ============================================ */

/* Ensure main content area has proper spacing */
main > div > div {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 0;
}

/* Page title section - consistent spacing */
main > div > div > div:first-child {
  margin-bottom: 0;
}

/* Card container - ensure proper width and spacing */
main > div > div > div:nth-child(2) {
  width: 100%;
  max-width: 100%;
  margin: 0;
}

/* ============================================
   Filter Section - Layout & Alignment
   ============================================ */

/* Filter section container - flexbox for proper alignment */
main > div > div > div:nth-child(2) > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border_color);
}

/* Top row: "Showing X doctors" text */
main > div > div > div:nth-child(2) > div:first-child > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0;
}

/* Bottom row: Search, Status filter, and Add Doctor button */
main > div > div > div:nth-child(2) > div:first-child > div:last-child {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  width: 100%;
}

/* Search input container - ensure it doesn't grow too much */
main > div > div > div:nth-child(2) > div:first-child > div:last-child > div:first-child {
  flex: 1 1 auto;
  min-width: 200px;
  max-width: 400px;
}

/* Status filter container */
main > div > div > div:nth-child(2) > div:first-child > div:last-child > div:last-child {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ============================================
   Add Doctor Button - Natural Placement
   ============================================ */

.add-doctor-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 7px 20px;
  font-size: var(--btn-font-size);
  font-weight: 500;
  color: var(--white);
  background-color: rgba(var(--primary), 1);
  border: 1px solid rgba(var(--primary), 1);
  border-radius: 5px;
  cursor: pointer;
  transition: var(--app-transition);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

.add-doctor-button:hover,
.add-doctor-button:focus {
  background-color: rgba(var(--primary), 0.9);
  border-color: rgba(var(--primary), 0.9);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(var(--primary), 0.3);
}

.add-doctor-button:active {
  transform: translateY(0);
}

.add-doctor-button i {
  font-size: 1rem;
  line-height: 1;
}

/* ============================================
   Table/Content Section
   ============================================ */

/* Table container - proper padding and layout */
main > div > div > div:nth-child(2) > div:nth-child(2) {
  padding: 1.25rem;
  min-height: 200px;
  position: relative;
}

/* Table element */
main > div > div > div:nth-child(2) > div:nth-child(2) > table {
  width: 100%;
  margin: 0;
}

/* ============================================
   Empty State - Centered & Clear
   ============================================ */

/* Empty state paragraph - centered and styled */
main > div > div > div:nth-child(2) > div:nth-child(2) > p {
  text-align: center;
  color: rgba(var(--font-light-color), 1);
  font-size: 1rem;
  padding: 3rem 1.5rem;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

/* When table exists but is empty or has no rows */
main > div > div > div:nth-child(2) > div:nth-child(2) > table:empty + p,
main > div > div > div:nth-child(2) > div:nth-child(2) > table tbody:empty + p {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

/* Empty state when it's the only child */
main > div > div > div:nth-child(2) > div:nth-child(2):has(> p:only-child) {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

/* Make empty state more intentional */
main > div > div > div:nth-child(2) > div:nth-child(2) > p:only-child,
main > div > div > div:nth-child(2) > div:nth-child(2) > table + p {
  color: rgba(var(--font-light-color), 1);
  font-size: 1.1rem;
  line-height: 1.6;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Medium screens (tablets) */
@media (max-width: 992px) {
  /* Filter section stacks vertically on smaller screens */
  main > div > div > div:nth-child(2) > div:first-child > div:last-child {
    flex-direction: column;
    align-items: stretch;
  }

  /* Search input full width on medium screens */
  main > div > div > div:nth-child(2) > div:first-child > div:last-child > div:first-child {
    max-width: 100%;
  }

  /* Add Doctor button full width on medium screens */
  .add-doctor-button {
    width: 100%;
    justify-content: center;
    margin-left: 0;
  }
}

/* Small screens (mobile) */
@media (max-width: 768px) {
  /* Reduce padding on mobile */
  main > div > div > div:nth-child(2) > div:first-child {
    padding: 0.75rem 1rem;
  }

  main > div > div > div:nth-child(2) > div:nth-child(2) {
    padding: 1rem;
  }

  /* Stack filter controls vertically */
  main > div > div > div:nth-child(2) > div:first-child > div:last-child {
    gap: 0.75rem;
  }

  /* Status filter full width on mobile */
  main > div > div > div:nth-child(2) > div:first-child > div:last-child > div:last-child {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
}

/* ============================================
   Loading State
   ============================================ */

/* Loading text alignment */
main > div > div > div:nth-child(2) > div:nth-child(2) > div:contains("Loading") {
  text-align: center;
  padding: 2rem;
  color: rgba(var(--font-light-color), 1);
}

/* Alternative loading state selector */
main > div > div > div:nth-child(2) > div:nth-child(2) > div {
  text-align: center;
}

/* ============================================
   Card Consistency
   ============================================ */

/* Ensure card follows design system */
main > div > div > div:nth-child(2) {
  background-color: var(--white);
  border-radius: var(--app-border-radius);
  box-shadow: var(--box-shadow);
  overflow: hidden;
}

/* ============================================
   Visual Hierarchy Improvements
   ============================================ */

/* Page title - ensure proper spacing */
main > div > div > div:first-child h4 {
  margin-bottom: 0;
  font-weight: 600;
  color: var(--font-title-color);
}

/* Breadcrumb spacing */
main > div > div > div:first-child ol {
  margin-bottom: 0;
}

/* Ensure consistent spacing between sections */
main > div > div > div:first-child + div {
  margin-top: 0;
}
