/* ===================================================================
   HOSPITALS MANAGEMENT - Matching clients.css styling
   =================================================================== */

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

:root {
  --px-purple: #7B38C2;
  --px-ink: #0f1220;
  --px-ink-2: #171a2b;
  --px-border: #e9e9ef;
  --px-muted: #6b7280;
  --px-bg: #fafbfe;
  
  --radius: 18px;
  --shadow: 0 8px 28px rgba(15,18,32,.08);
  
  --gray-900: #2b2f42;
  --gray-700: #3b4153;
  --gray-600: #6b7280;
  --gray-400: #9ca3af;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50: #f8f9fc;
  
  --white: #ffffff;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  
  --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  font-family: var(--font-family);
  background: var(--px-bg);
  color: var(--gray-900);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===================================================================
   HEADER
   =================================================================== */

.header {
  background: var(--white);
  padding: 14px 40px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1330px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topline {
  max-width: 1330px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-top: 6px;
  padding-bottom: 8px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-img {
  height: 52px;
  width: auto;
  display: block;
}

.header-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.title {
  font-weight: 800;
  font-size: 18px;
  color: #2b2f42;
}

.subtitle {
  color: #636a7a;
  font-weight: 500;
  font-size: 13px;
}

.divider {
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--px-purple), #b08be4 70%, #d6c7f2);
  opacity: 0.85;
  max-width: 1330px;
  margin: 0 auto;
}

/* ===================================================================
   STATS BAR
   =================================================================== */

.stats {
  max-width: 1330px;
  margin: 14px auto;
  background: var(--px-ink);
  color: #fff;
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
}

.stat b {
  font-size: 18px;
}

.badge {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  user-select: none;
  font-weight: 600;
}

.page-header {
  max-width: 1330px;
  margin: 0 auto;
  padding: 0 40px;
}

/* ===================================================================
   BUTTONS
   =================================================================== */

.btn-primary,
.btn-secondary,
.btn-delete,
.btn-map {
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 14px;
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: var(--px-purple);
  color: var(--white);
}

.btn-primary:hover {
  background: #6a2fb0;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(123, 56, 194, 0.3);
}

.btn-secondary {
  background: var(--white);
  color: var(--gray-900);
  border: 2px solid var(--px-border);
}

.btn-secondary:hover {
  border-color: var(--px-purple);
  color: var(--px-purple);
}

.btn-delete {
  background: var(--error);
  color: var(--white);
}

.btn-delete:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.4);
}

.btn-map {
  background: var(--white);
  color: var(--px-purple);
  border: 2px solid var(--px-purple);
  padding: 10px 20px;
  font-size: 13px;
  width: 100%;
  margin-bottom: 8px;
}

.btn-map:hover {
  background: var(--px-purple);
  color: var(--white);
}

/* ===================================================================
   MAIN CONTENT LAYOUT
   =================================================================== */

.main-content {
  max-width: 1330px;
  margin: 20px auto;
  padding: 0 40px;
  display: flex;
  gap: 20px;
}

/* ===================================================================
   COUNTRY SIDEBAR
   =================================================================== */

.country-sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--white);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--px-border);
  height: fit-content;
  position: sticky;
  top: 170px;
}

.country-sidebar h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--px-border);
}

.country-sidebar ul {
  list-style: none;
}

.country-sidebar li {
  padding: 10px 12px;
  margin-bottom: 4px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.2s ease;
}

.country-sidebar li:hover {
  background: rgba(123, 56, 194, 0.1);
  color: var(--px-purple);
}

.country-sidebar li.active {
  background: var(--px-purple);
  color: var(--white);
}

/* ===================================================================
   HOSPITALS SECTION
   =================================================================== */

.hospitals-section {
  flex: 1;
}

.search-container {
  position: relative;
  margin-bottom: 20px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 14px 16px 14px 48px;
  font-size: 14px;
  font-family: var(--font-family);
  font-weight: 500;
  border: 2px solid var(--px-border);
  border-radius: 12px;
  background: var(--white);
  color: var(--gray-900);
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--px-purple);
  box-shadow: 0 0 0 3px rgba(123, 56, 194, 0.1);
}

/* ===================================================================
   TABLE
   =================================================================== */

.table-container {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--px-border);
  overflow: auto;
  max-height: calc(100vh - 320px);
  position: relative;
}

#hospitalsTable {
  width: 100%;
  border-collapse: collapse;
}

#hospitalsTable thead {
  background: var(--px-ink);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 10;
}

#hospitalsTable th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  user-select: none;
  background: var(--px-ink);
}

#hospitalsTable th:hover {
  background: rgba(15, 18, 32, 0.9);
}

#hospitalsTable tbody tr {
  border-bottom: 1px solid var(--px-border);
  cursor: pointer;
  transition: all 0.15s ease;
}

#hospitalsTable tbody tr:hover {
  background: rgba(123, 56, 194, 0.05);
}

#hospitalsTable td {
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-900);
}

#hospitalsTable td:first-child {
  color: var(--px-purple);
  font-weight: 700;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--px-muted);
  font-style: italic;
}

/* ===================================================================
   MODAL
   =================================================================== */

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 18, 32, 0.6);
  backdrop-filter: blur(6px);
  overflow-y: auto;
}

.modal-content {
  background-color: var(--white);
  margin: 40px auto;
  border-radius: var(--radius);
  width: 90%;
  max-width: 600px;
  box-shadow: 0 20px 60px rgba(15, 18, 32, 0.25);
  border: 1px solid var(--px-border);
}

.modal-hospital {
  max-width: 1200px;
}

.modal-header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--px-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--gray-900);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  font-weight: 300;
  color: var(--gray-400);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.modal-body {
  padding: 24px 28px;
}

.modal-hospital-body {
  display: flex;
  gap: 20px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 20px 28px;
  border-top: 1px solid var(--px-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ===================================================================
   HOSPITAL FORM
   =================================================================== */

.hospital-form-container {
  flex: 1;
  min-width: 400px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-family);
  font-weight: 500;
  border: 2px solid var(--px-border);
  border-radius: 8px;
  background: var(--gray-50);
  color: var(--gray-900);
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--px-purple);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(123, 56, 194, 0.08);
}

.form-group input[readonly] {
  background: #e8e8e8;
  cursor: not-allowed;
}

/* ===================================================================
   MAP CONTAINER
   =================================================================== */

.hospital-map-container {
  flex: 1;
  min-width: 400px;
  display: flex;
  flex-direction: column;
}

.map {
  width: 100%;
  height: 400px;
  border-radius: 12px;
  border: 2px solid var(--px-border);
  margin-bottom: 12px;
}

/* ===================================================================
   ACCENTS PANEL
   =================================================================== */

.accents-panel {
  background: var(--white);
  border: 2px solid var(--px-purple);
  border-radius: 12px;
  padding: 16px;
  margin-top: 12px;
}

.accents-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--px-purple);
  margin-bottom: 12px;
}

.accents-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.accents-grid button {
  padding: 10px;
  font-size: 18px;
  font-weight: 600;
  border: 2px solid var(--px-border);
  background: var(--white);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.accents-grid button:hover {
  background: var(--px-purple);
  color: var(--white);
  border-color: var(--px-purple);
}

/* ===================================================================
   RESPONSIVE
   =================================================================== */

@media (max-width: 1024px) {
  .main-content {
    flex-direction: column;
  }
  
  .country-sidebar {
    width: 100%;
    position: static;
  }
  
  .country-sidebar ul {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .modal-hospital-body {
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 12px 20px 0;
  }
  
  .main-content {
    padding: 0 20px;
  }
  
  .modal-content {
    width: 95%;
    margin: 20px auto;
  }
  
  .hospital-form-container,
  .hospital-map-container {
    min-width: 100%;
  }
}