/* Custom Styles for Setad Bazsazi Iran Website */

:root {
  --primary-color: #0066cc;
  --secondary-color: #004499;
  --accent-color: #f39c12;
  --text-color: #333;
  --bg-light: #f8f9fa;
  --border-color: #dee2e6;

  /* Iran flag colors */
  --iran-green: #239F40;
  --iran-red: #DA0000;
  --iran-white: #FFFFFF;
}

/* ==========================================================================
   RTL Support for Persian
   ========================================================================== */

/* Force RTL styles when body has 'fa' class */
body.fa {
  direction: rtl;
}

/* Fix navigation flexbox for RTL */
body.fa nav ul {
  flex-direction: row;
}

body.fa nav li {
  display: inline-block;
}

/* Fix margins and padding for RTL */
body.fa .grid {
  direction: rtl;
}

/* ==========================================================================
   Body Background - Iran Flag Gradient
   ========================================================================== */

body {
  min-height: 100vh;
  /* Subtle gradient from green to white (Iran flag inspired) */
  background:
    linear-gradient(
      to bottom,
      rgba(35, 159, 64, 0.15) 0%,
      rgba(35, 159, 64, 0.08) 15%,
      rgba(255, 255, 255, 0) 30%
    ),
    linear-gradient(
      to top,
      rgba(218, 0, 0, 0.12) 0%,
      rgba(218, 0, 0, 0.06) 10%,
      rgba(255, 255, 255, 0) 25%
    ),
    #FFFFFF;
  background-attachment: fixed;
}

/* ==========================================================================
   Font Settings
   ========================================================================== */

/* Persian font */
body.fa {
  font-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif;
}

/* English font */
body.en {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* ==========================================================================
   Language Switcher
   ========================================================================== */

.lang-switch {
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  background-color: var(--bg-light);
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  transition: all 0.3s ease;
  text-decoration: none;
}

.lang-switch:hover {
  background-color: var(--primary-color);
  color: white;
}

.lang-link {
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
  transition: all 0.3s ease;
}

.lang-link:hover {
  background-color: var(--secondary-color);
}

/* ==========================================================================
   Navigation
   ========================================================================== */

nav {
  border-bottom: 1px solid var(--border-color);
  padding: 0.5rem 0;
  margin-bottom: 1.5rem;
}

nav .logo {
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
  font-size: 1.2rem;
}

nav a {
  color: var(--text-color);
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  transition: color 0.2s ease;
}

nav a:hover,
nav a.active {
  color: var(--primary-color);
}

/* Desktop: responsive font for nav links */
@media (min-width: 769px) and (max-width: 900px) {
  .nav-links a {
    font-size: 13px;
  }
}

@media (min-width: 901px) {
  .nav-links a {
    font-size: 15px;
  }
}

/* Ensure nav items are horizontal */
nav ul {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
}

nav ul li {
  display: inline-block;
}

/* Desktop: Add separator between nav links */
@media (min-width: 769px) {
  .nav-links li:not(:last-child)::after {
    content: "|";
    margin: 0 0.5rem;
    opacity: 0.1;
    color: var(--text-color);
  }
}

/* ==========================================================================
   Toolbar (Sticky bar below header)
   ========================================================================== */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 999;
  display: flex;
  justify-content: flex-end;
  margin: 0.5rem 0 0;
  max-width: fit-content;
}

/* LTR (English): align to right */
[dir="ltr"] .toolbar {
  margin-left: auto;
  margin-right: 0;
}

/* RTL (Persian): align to left */
[dir="rtl"] .toolbar {
  margin-right: auto;
  margin-left: 0;
}

.toolbar-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

/* Theme toggle button */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem;
  border: none;
  border-radius: 12px;
  background-color: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.theme-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  color: var(--text-color);
}

/* Language link in toolbar */
.toolbar-lang {
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  background-color: transparent;
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.7;
  transition: all 0.2s ease;
}

.toolbar-lang:hover {
  opacity: 1;
  background-color: rgba(0, 0, 0, 0.05);
}

/* Dark mode styles */
[data-theme="dark"] .toolbar-content {
  background-color: rgba(30, 30, 30, 0.85);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .theme-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .toolbar-lang {
  color: #e0e0e0;
}

[data-theme="dark"] .toolbar-lang:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] {
  color-scheme: dark;
}

/* ==========================================================================
   Footer
   ========================================================================== */

footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

footer hr {
  margin: 1rem 0;
}

footer .grid {
  text-align: start;
}

.copyright {
  display: block;
  margin-top: 1rem;
  opacity: 0.7;
}

/* ==========================================================================
   Card Styles
   ========================================================================== */

.card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  transition: box-shadow 0.3s ease;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Service List
   ========================================================================== */

.service-list {
  list-style: none;
  padding: 0;
}

.service-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.service-list li:last-child {
  border-bottom: none;
}

.service-list li::before {
  content: "✓";
  color: var(--primary-color);
  font-weight: bold;
}

body.fa .service-list li::before {
  margin-left: 0.5rem;
}

body.en .service-list li::before {
  margin-right: 0.5rem;
}

/* ==========================================================================
   Form Styles
   ========================================================================== */

form {
  max-width: 600px;
  margin: 0 auto;
}

form label {
  margin-bottom: 1rem;
  display: block;
}

form input,
form textarea,
form select {
  width: 100%;
  margin-bottom: 1rem;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

button,
a[role="button"] {
  cursor: pointer;
  transition: all 0.2s ease;
}

button:hover,
a[role="button"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   Hamburger Menu Button
   ========================================================================== */

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
}

.hamburger span {
  width: 100%;
  height: 3px;
  background-color: var(--text-color);
  border-radius: 3px;
  transition: all 0.3s ease;
}

.hamburger:hover span {
  background-color: var(--primary-color);
}

/* Hamburger animation when menu is open */
.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* RTL hamburger transform */
body.fa .hamburger.active span:nth-child(1) {
  transform: rotate(-45deg) translate(-5px, 5px);
}

body.fa .hamburger.active span:nth-child(3) {
  transform: rotate(45deg) translate(-7px, -6px);
}

/* ==========================================================================
   Navigation Links (Mobile)
   ========================================================================== */

.nav-links {
  transition: all 0.3s ease;
}

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

@media (max-width: 768px) {
  nav {
    padding: 0.75rem 0;
    position: relative;
  }

  /* Show hamburger on mobile */
  .hamburger {
    display: flex;
  }

  /* Hide nav links by default on mobile */
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    {% if lang == 'en' %}left: 0; right: 0;{% else %}right: 0; left: 0;{% endif %}
    background-color: var(--bg-light);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    flex-direction: column;
    padding: 1rem 0;
    z-index: 1000;
  }

  /* Show nav links when menu is open */
  .nav-links.active {
    display: flex;
  }

  .nav-links li {
    width: 100%;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
  }

  .nav-links li:last-child {
    border-bottom: none;
  }

  .nav-links a {
    display: block;
    padding: 1rem;
  }
}

@media (min-width: 769px) {
  /* Desktop: hide hamburger, show nav links normally */
  .hamburger {
    display: none !important;
  }

  .nav-links {
    display: flex !important;
  }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

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

.mt-2 {
  margin-top: 2rem;
}

.mb-2 {
  margin-bottom: 2rem;
}

/* ==========================================================================
   Smooth Transitions
   ========================================================================== */

* {
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* ==========================================================================
   Section Spacing
   ========================================================================== */

section {
  padding: 2rem 0;
}

/* ==========================================================================
   Heading Styles
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  color: var(--text-color);
}

h1 {
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

/* RTL heading fix */
body.fa h1,
body.fa h2,
body.fa h3,
body.fa h4,
body.fa h5,
body.fa h6 {
  text-align: right;
}

/* LTR heading fix */
body.en h1,
body.en h2,
body.en h3,
body.en h4,
body.en h5,
body.en h6 {
  text-align: left;
}

/* ==========================================================================
   Main Container
   ========================================================================== */

main.container {
  min-height: 60vh;
  padding: 2rem 1rem;
}

/* ==========================================================================
   Images
   ========================================================================== */

.poster-image {
  display: block;
  margin-left: auto;
  margin-right: auto;
  max-width: 100%;
  height: auto;
}
