/* =========================================================
   AwadhMed Final Clear Text Visibility Patch
   Purpose: keep existing UI/features unchanged while making all words readable.
   Loaded last in every HTML page.
   ========================================================= */

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body,
button,
input,
select,
textarea {
  font-family: Inter, Montserrat, Arial, sans-serif !important;
  line-height: 1.55 !important;
}

body {
  color: var(--text, #0f172a) !important;
  font-weight: 500 !important;
  letter-spacing: 0.005em;
}

/* Strong readable theme variables */
:root,
html[data-theme="bright"],
body[data-theme="bright"] {
  --text: #0f172a !important;
  --text-primary: #0f172a !important;
  --text-secondary: #334155 !important;
  --text-muted: #475569 !important;
  --muted: #475569 !important;
}

html[data-theme="dark"],
body[data-theme="dark"],
.dark-theme {
  --text: #fff7d6 !important;
  --text-primary: #fff7d6 !important;
  --text-secondary: #e5edf7 !important;
  --text-muted: #cbd5e1 !important;
  --muted: #cbd5e1 !important;
}

/* Headings */
h1, h2, h3, h4, h5, h6,
.section-title,
.card-title,
.service-title,
.med-card-name,
.brand-text,
.panel-head h3,
.headline h1,
.amx-title,
.aw-modal-head h3 {
  color: var(--text-primary, #0f172a) !important;
  font-weight: 850 !important;
  letter-spacing: -0.01em;
  line-height: 1.22 !important;
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6,
.panel h1,
.panel h2,
.panel h3,
.panel h4,
.amx-panel h1,
.amx-panel h2,
.amx-panel h3,
.amx-panel h4,
.aw-med-modal-box h1,
.aw-med-modal-box h2,
.aw-med-modal-box h3,
.aw-med-modal-box h4 {
  color: #fff7d6 !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

/* Paragraphs and normal text */
p, li, label, span, small,
.description,
.subtitle,
.service-description,
.svc-features,
.card p,
.awm-card p,
.amx-card p,
.amx-sub,
.headline p,
.brand span,
.empty,
.lbl {
  color: var(--text-secondary, #334155) !important;
  font-weight: 550 !important;
  line-height: 1.62 !important;
}

html[data-theme="dark"] p,
html[data-theme="dark"] li,
html[data-theme="dark"] label,
html[data-theme="dark"] span,
html[data-theme="dark"] small,
.panel p,
.panel li,
.panel label,
.panel span,
.panel small,
.amx-panel p,
.amx-panel li,
.amx-panel label,
.amx-panel span,
.amx-panel small,
.aw-med-modal-box p,
.aw-med-modal-box label,
.aw-med-modal-box span,
.aw-med-modal-box small {
  color: #dbe7f5 !important;
}

/* Prevent tiny unreadable labels */
small,
.badge,
.chip,
.lbl,
.kicker,
.amx-kicker,
.tbl-status,
.awm-stepper span,
.awm-timeline span,
.track-step-sub,
.service-tag,
.med-card-generic,
.am-google-msg,
.aw-save,
.table th,
.table td,
th,
td {
  font-size: max(12px, 0.76rem) !important;
  line-height: 1.45 !important;
}

.card p,
.service-card p,
.service-card li,
.awm-card,
.awm-order-card,
.amx-card,
.panel-body,
.table td,
.form input,
.form select,
.awm-form input,
.awm-form select,
.amx-input,
.amx-select,
.amx-textarea {
  font-size: max(14px, 0.88rem) !important;
}

/* Bright cards */
html[data-theme="bright"] .card,
html[data-theme="bright"] .service-card,
html[data-theme="bright"] .smart-feature-card,
html[data-theme="bright"] .medicine-card,
html[data-theme="bright"] .med-card,
html[data-theme="bright"] .search-panel,
html[data-theme="bright"] .modal-content,
html[data-theme="bright"] .auth-modal,
html[data-theme="bright"] .checkout-card,
html[data-theme="bright"] .dashboard-card,
html[data-theme="bright"] .order-card,
html[data-theme="bright"] .report-card,
html[data-theme="bright"] .scheme-card,
html[data-theme="bright"] .camp-card,
html[data-theme="bright"] .doctor-card,
html[data-theme="bright"] .hospital-card,
html[data-theme="bright"] .lab-card {
  background: rgba(255,255,255,0.97) !important;
  color: #0f172a !important;
  border-color: rgba(148,163,184,0.35) !important;
  text-shadow: none !important;
}

html[data-theme="bright"] .card *,
html[data-theme="bright"] .service-card *,
html[data-theme="bright"] .medicine-card *,
html[data-theme="bright"] .med-card *,
html[data-theme="bright"] .checkout-card *,
html[data-theme="bright"] .dashboard-card *,
html[data-theme="bright"] .order-card *,
html[data-theme="bright"] .doctor-card *,
html[data-theme="bright"] .hospital-card *,
html[data-theme="bright"] .lab-card * {
  text-shadow: none !important;
}

/* Dark cards and panels */
html[data-theme="dark"] .card,
html[data-theme="dark"] .service-card,
html[data-theme="dark"] .smart-feature-card,
html[data-theme="dark"] .medicine-card,
html[data-theme="dark"] .med-card,
.aw-med-modal-box,
.amx-panel,
.amx-card,
.panel,
.awm-checkout,
.awm-cart {
  color: #f8fafc !important;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .service-card,
html[data-theme="dark"] .smart-feature-card,
html[data-theme="dark"] .medicine-card,
html[data-theme="dark"] .med-card,
.aw-med-modal-box,
.amx-panel,
.panel {
  background-color: rgba(10,15,30,0.96) !important;
  border-color: rgba(201,168,76,0.32) !important;
}

/* Tables */
table, .table, .amx-table {
  color: inherit !important;
}

th, .table th, .amx-table th {
  color: #f2d984 !important;
  font-weight: 900 !important;
  letter-spacing: 0.06em !important;
  background: rgba(201,168,76,0.12) !important;
}

td, .table td, .amx-table td {
  color: #eef4ff !important;
  font-weight: 650 !important;
  word-break: break-word;
}

html[data-theme="bright"] td,
html[data-theme="bright"] .table td,
html[data-theme="bright"] .amx-table td {
  color: #1e293b !important;
}

/* Forms */
input,
select,
textarea,
.amx-input,
.amx-select,
.amx-textarea,
.awm-form input,
.awm-form select,
.form input,
.form select,
#awmTrackInput {
  color: #0f172a !important;
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  font-weight: 650 !important;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
.amx-input,
.amx-select,
.amx-textarea,
.aw-med-modal-box input,
.aw-med-modal-box select,
.aw-med-modal-box textarea,
.panel input,
.panel select,
.panel textarea {
  color: #ffffff !important;
  background: rgba(15,23,42,0.94) !important;
  border-color: rgba(226,232,240,0.26) !important;
}

::placeholder {
  color: #64748b !important;
  opacity: 1 !important;
  font-weight: 550 !important;
}

html[data-theme="dark"] ::placeholder,
.amx-panel ::placeholder,
.aw-med-modal-box ::placeholder,
.panel ::placeholder {
  color: #cbd5e1 !important;
}

select option {
  color: #0f172a !important;
  background: #ffffff !important;
}

html[data-theme="dark"] select option,
.amx-panel select option,
.panel select option,
.aw-med-modal-box select option {
  color: #ffffff !important;
  background: #111827 !important;
}

/* Buttons and links */
button,
.btn,
.awm-primary,
.awm-secondary,
.amx-btn,
.header-right-btn,
.header-nav-btn,
.section-tab {
  font-weight: 850 !important;
  letter-spacing: 0.01em;
}

.primary,
.btn.primary,
.awm-primary,
.amx-btn:not(.secondary) {
  color: #07101f !important;
  text-shadow: none !important;
}

a,
.link,
.nav a {
  font-weight: 750 !important;
  text-underline-offset: 3px;
}

.section-tab,
.nav,
.header-nav-btn,
.header-right-btn {
  color: var(--text-secondary, #334155) !important;
}

.section-tab:hover,
.section-tab.active-blue,
.section-tab.active-gold,
.section-tab.active-rose,
.nav.active,
.nav:hover {
  color: var(--gold, #c9a84c) !important;
}

/* Modal readability over background images */
.login-modal,
.auth-modal,
.modal-content,
.aw-med-modal-box,
.amx-panel,
.awm-checkout {
  isolation: isolate;
}

.login-modal::before,
.auth-modal::before,
.modal-content::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(3,7,18,0.58), rgba(3,7,18,0.34));
  z-index: -1;
}

html[data-theme="bright"] .modal-content::before,
html[data-theme="bright"] .auth-modal::before {
  background: linear-gradient(90deg, rgba(255,255,255,0.78), rgba(255,255,255,0.58));
}

/* Medicine/order details */
.med-card-name,
.aw-modal-head h3,
.aw-price-card b,
.price,
.amount,
.total,
.num {
  font-weight: 900 !important;
}

.aw-price-card span,
.aw-med-full-details p,
.aw-med-full-details b,
.am-med-option .name,
.am-med-option,
.awm-cart-row,
.awm-cart-row small,
.awm-order-card small {
  color: inherit !important;
}

/* Mobile readability */
@media (max-width: 768px) {
  body {
    font-size: 15px !important;
  }

  h1,
  .headline h1,
  .section-title {
    font-size: clamp(1.45rem, 6vw, 2.1rem) !important;
  }

  h2 {
    font-size: clamp(1.25rem, 5vw, 1.7rem) !important;
  }

  .card,
  .service-card,
  .smart-feature-card,
  .medicine-card,
  .med-card,
  .panel-body,
  .awm-checkout,
  .amx-body {
    padding: max(14px, 0.95rem) !important;
  }

  .table th,
  .table td,
  .amx-table th,
  .amx-table td {
    font-size: 13px !important;
  }
}
