/*
 * Sarop Health Enterprise V3
 *
 * This stylesheet defines a neutral, professional interface designed to
 * instill trust for government and organisational audiences. A restrained
 * colour palette, generous spacing and consistent typography ensure
 * clarity and accessibility across languages. Right‑to‑left languages
 * inherit these styles via the direction attribute on the html tag.
 */

:root {
  /* Colour palette
     Dark navy conveys trust and authority while gold highlights
     important calls to action. Secondary colours provide contrast
     for body text and muted backgrounds.
  */
  --primary: #002855;
  --secondary: #415a77;
  --gold: #c0953c;
  /*
   * Colour variables for light/dark themes
   * These variables represent the base surfaces and text colours used
   * throughout the UI. By overriding them in a data-theme="dark"
   * context we achieve a consistent dark mode without duplicating
   * individual styles. When additional colours are introduced, add
   * corresponding variables here and override as needed below.
   */
  --color-bg: #f8f9fb;
  --color-section-alt: #eef1f5;
  --color-card-bg: #ffffff;
  --color-card-border: rgba(0, 0, 0, 0.1);
  --color-header-bg: #ffffff;
  --color-footer-bg: #f8f9fb;
  --color-nav-link-hover-bg: rgba(0, 0, 0, 0.05);
  --color-nav-link-active-bg: var(--primary);
  --color-text: #1f2937;
  --color-text-inverse: #f9fafb;
  /* Define legacy text colours for compatibility with existing rules.
     These variables mirror the primary and inverse text colours so that
     older selectors (e.g. var(--text-light) and var(--text-dark))
     continue to resolve correctly in both light and dark modes. */
  --text-dark: var(--color-text);
  --text-light: var(--color-text-inverse);
  --radius: 6px;
  --transition: 0.2s ease;
  --max-width: 1200px;
  /* Hero gradient for a professional look without AI‑generated imagery */
  --hero-grad: linear-gradient(135deg, #01295f 0%, #415a77 100%);

  /*
   * Additional gradient variables
   * These define subtle gradients used on alternating sections and
   * trust/security panels. Gradients help break up long runs of
   * solid colour and reinforce the sense of forward motion and
   * innovation without resorting to AI‑generated artwork. They are
   * overridden for dark mode below with deeper tones.
   */
  --section-grad: linear-gradient(180deg, #f8f9fb 0%, #eef1f5 100%);
  --trust-grad: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

/*
 * Dark theme overrides
 * When the data-theme attribute on the root element is set to "dark",
 * these variables redefine the UI palette. The hero gradient is also
 * adjusted to a deeper scheme. Additional overrides should be added
 * here if new variables are introduced above.
 */
[data-theme='dark'] {
  --color-bg: #071c33;
  --color-section-alt: #0b2345;
  --color-card-bg: #0e2442;
  --color-card-border: rgba(255, 255, 255, 0.1);
  --color-header-bg: #0e2442;
  --color-footer-bg: #071c33;
  --color-nav-link-hover-bg: rgba(255, 255, 255, 0.1);
  --color-nav-link-active-bg: var(--secondary);
  --color-text: #dde6f5;
  --color-text-inverse: #e8f1ff;
  /* Keep legacy variables in sync under dark theme */
  --text-dark: var(--color-text);
  --text-light: var(--color-text-inverse);
  /* Adjust brand colours for dark mode. Lighter tones ensure
     headings and accents remain legible against dark surfaces
     while preserving the original palette's hue. */
  --primary: #8fb9d9;
  --secondary: #9db8d4;
  /* darker gradient for hero */
  --hero-grad: linear-gradient(135deg, #011526 0%, #09376c 100%);

  /* Dark mode gradients: choose deeper hues for subtle contrast */
  --section-grad: linear-gradient(180deg, #071c33 0%, #0b2345 100%);
  --trust-grad: linear-gradient(135deg, #01295f 0%, #224a7a 100%);
}

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

body {
  font-family: "Inter", "Vazirmatn", Arial, sans-serif;
  line-height: 1.6;
  /* Use theme variables for background and text colours */
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

header {
  background: var(--color-header-bg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 1000;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
}

/*
 * Navigation bar
 *
 * On wide screens the navigation should remain compact and legible.
 * Reduce the overall spacing and padding so that a long list of links
 * does not dominate the header. When the viewport narrows the nav
 * collapses into the mobile drawer (see responsive rule below).
 */
.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  /* Tighten the gap between links; smaller spacing keeps the
     navigation from feeling oversized on desktop. */
  gap: 0.5rem;
}

/*
 * Navigation links
 *
 * Reduce padding further to prevent the nav bar from stretching
 * excessively across large screens. Links retain their rounded
 * corners and bold weight for clarity.
 */
.nav a {
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background var(--transition);
}

.nav a.active,
.nav a:hover {
  background: var(--color-nav-link-hover-bg);
  text-decoration: none;
}

.nav a.active {
  background: var(--color-nav-link-active-bg);
  color: var(--color-text-inverse);
  text-decoration: none;
}

.nav .btn-primary {
  background: var(--gold);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
}

.nav .btn-primary:hover {
  background: #b3862c;
}

.nav .lang-switch {
  display: flex;
  gap: 0.5rem;
  margin-left: 1rem;
}

.nav .lang-switch a {
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
}

.nav .lang-switch a.active {
  background: var(--color-nav-link-active-bg);
  color: var(--color-text-inverse);
}

/* Theme toggle button */
.theme-toggle {
  margin-left: 1rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--color-nav-link-hover-bg);
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-text);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.theme-toggle:hover {
  background: var(--color-nav-link-hover-bg);
}

/* Hero */
/*
 * Hero section
 *
 * To convey a modern, forward‑looking aesthetic we layer a
 * high‑quality illustration behind a dark overlay. This keeps
 * text readable while hinting at technology and care working
 * together. The hero image is defined in the assets/img folder.
 */
.hero {
  /* Use a clean gradient instead of an AI‑generated image */
  background: var(--hero-grad);
  color: var(--text-light);
  padding: 3rem 0;
  position: relative;
}

/* ensure content in hero sits above background */
.hero .container {
  position: relative;
  z-index: 0;
}

.hero .container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.3;
}

.hero p {
  font-size: 1.1rem;
  max-width: 60ch;
}

.hero .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
  border: 2px solid transparent;
}

.btn-primary {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
}

.btn-primary:hover {
  background: #b3862c;
}

.btn-outline {
  background: transparent;
  color: var(--gold);
  border-color: var(--gold);
}

.btn-outline:hover {
  background: var(--gold);
  color: #fff;
}

/* Sections */
.section {
  padding: 2rem 0;
}

/* Alternate sections: apply a gentle gradient instead of a flat colour
 * to break up the page flow. The gradient is defined via the
 * --section-grad variable and responds to the selected theme. */
.section:nth-of-type(even) {
  background: var(--section-grad);
}

.section .container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem;
}

.section h2 {
  margin-bottom: 1rem;
  font-size: 1.8rem;
  color: var(--primary);
}

/* Dark mode overrides for section headings */
[data-theme='dark'] .section h2 {
  color: var(--color-text-inverse);
}

/* Grid & Cards */
.grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

/* Download cards
 *
 * A dedicated layout for the app download section. Cards are
 * centred, include a visual preview and call‑to‑action buttons.
 */
.download-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.download-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.download-card img {
  /* Hide legacy images: download cards now show stylised badges instead of artwork */
  display: none;
}

/* Download card custom icon
 *
 * Download cards use simple circular badges instead of AI‑generated
 * artwork. Each badge displays an initial or short label and
 * harmonises with the rest of the palette. Adjust sizing as needed.
 */
.download-card .download-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.4rem;
  margin: 0 auto 1rem;
}

.card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/*
 * Card icons
 *
 * The previous version used emoji symbols for icons, which felt
 * informal. In this enterprise edition we replace those with
 * simple, high‑contrast circular badges. Each badge inherits
 * its content from the HTML (e.g. initial letter) or can be
 * left empty; the colour provides a visual anchor without
 * distracting from the message. Adjust the size as needed.
 */
.card .icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.card h3 {
  font-size: 1.25rem;
  color: var(--primary);
}

.card p {
  color: var(--secondary);
}

/* Dark mode overrides for card text
 * When dark mode is active, card headings and body text switch to
 * the generic text colours to ensure sufficient contrast against
 * the darker card backgrounds. */
[data-theme='dark'] .card h3 {
  color: var(--color-text-inverse);
}
[data-theme='dark'] .card p {
  color: var(--color-text);
}

/* Trust & Security */
.trust {
  /* Trust section uses a gradient background that blends the
     primary and secondary colours. This reinforces a sense of
     continuity and dynamism while maintaining high contrast. The
     gradient adapts via --trust-grad for dark and light modes. */
  background: var(--trust-grad);
  color: var(--color-text-inverse);
  padding: 2rem 0;
}

.trust .container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem;
}

.trust h2 {
  color: var(--color-text-inverse);
  margin-bottom: 1rem;
}

.trust ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.trust li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 1rem;
}

/*
 * Trust list icons
 *
 * Simplified circular badges for trust points. Use a check mark
 * or other character via HTML to indicate the nature of each
 * item. Colours harmonise with the rest of the palette.
 */
.trust li .icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.trust li strong {
  color: var(--color-text-inverse);
}

/* Footer */
.footer {
  /* Footer adapts to the current theme */
  background: var(--color-footer-bg);
  color: var(--color-text);
  padding: 1.5rem 0;
}

.footer .container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.footer p {
  margin: 0;
}

.footer a {
  color: var(--gold);
}

/*
 * Full‑width call‑to‑action section
 * This section spans the entire viewport width and uses a gradient
 * derived from the trust colour scheme. It centres its content
 * vertically and horizontally, with text and button colours that
 * adapt to the current theme. Use this section for important
 * announcements or invitations to engage.
 */
.cta-full {
  padding: 3rem 0;
  background: var(--trust-grad);
  color: var(--color-text-inverse);
  text-align: center;
}
/*
 * Full width CTA content
 * Remove any artificial width constraints so the call‑to‑action can
 * span the entire viewport. Individual elements are centred with
 * automatic margins. Restrict the maximum width of text to improve
 * readability on very large screens.
 */
.cta-full h2 {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
  color: var(--color-text-inverse);
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}
.cta-full p {
  margin-bottom: 1.25rem;
  color: var(--color-text-inverse);
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}
.cta-full .btn {
  margin-top: 0.5rem;
}

/* Allow the container inside the CTA to fill the full width. This
 * prevents the standard container margin from constraining the
 * call‑to‑action section. */
.cta-full .container {
  max-width: none;
  width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Responsive adjustments */
@media (min-width: 768px) {
  .hero .container {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .hero .container .text {
    flex: 1;
  }
  .hero .container .image {
    flex: 1;
  }
  .footer .container {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

/* Mobile drawer styles */
.mobile-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  display: none;
}

.mobile-drawer.open {
  display: block;
}

.mobile-drawer .backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.mobile-drawer .panel {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 80%;
  max-width: 300px;
  /* Use the card background and text variables so the drawer
     automatically follows the selected theme. */
  background: var(--color-card-bg);
  color: var(--color-text);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
}

.mobile-drawer .hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding: 1rem;
  font-weight: 700;
}

/* Dark mode adjustments for the mobile drawer */
[data-theme='dark'] .mobile-drawer .hd {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}
[data-theme='dark'] .mobile-drawer .bd a:hover {
  background: rgba(255, 255, 255, 0.1);
}

/*
 * In dark mode the drawer panel should stand out clearly from the
 * dark backdrop. Override the background colour to a slightly
 * lighter shade than the surrounding page so users can easily
 * distinguish the panel contents. Keep the text colour consistent.
 */
[data-theme='dark'] .mobile-drawer .panel {
  background: #122f57;
  color: var(--color-text);
}

.mobile-drawer .bd {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mobile-drawer .bd a {
  padding: 0.5rem;
  border-radius: var(--radius);
  transition: background var(--transition);
  /* Match the drawer link colour to the current theme */
  color: var(--color-text);
}

.mobile-drawer .bd a:hover {
  /* Hover background adapts for both themes. In dark mode
     the light hover provides subtle contrast. */
  background: rgba(0, 0, 0, 0.05);
}

/* Responsive nav toggle visibility */
@media (max-width: 900px) {
  .nav {
    display: none;
  }
  #navToggle {
    display: inline-flex !important;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary);
    cursor: pointer;
  }
}

/* Right‑to‑left support */
html[dir='rtl'] body {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  direction: rtl;
}

html[dir='rtl'] .header-inner {
  flex-direction: row-reverse;
}

html[dir='rtl'] .nav {
  flex-direction: row-reverse;
}

html[dir='rtl'] .hero .container,
html[dir='rtl'] .section .container,
html[dir='rtl'] .trust .container,
html[dir='rtl'] .footer .container {
  text-align: right;
}

html[dir='rtl'] .grid {
  direction: rtl;
}

html[dir='rtl'] .nav .lang-switch {
  margin-left: 0;
  margin-right: 1rem;
}