/* --------- THEME VARIABLES --------- */
:root {
  --navy: #001F3F;
  --charcoal: #36454F;
  --gold: #D4AF37;
  --gold-light: #E6C88A;
  --white: #FFFFFF;
  --light-blue: #E6F2FF;
  --max-width: 1200px;
}

/* Import Persian-friendly font (Vazir) */
@import url("https://cdn.jsdelivr.net/gh/rastikerdar/vazir-font@v30.1.0/dist/font-face.css");

/* ---------- Base & RTL ---------- */
html[dir="rtl"], body {
  direction: rtl;
  font-family: "Vazir", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  color: var(--charcoal);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  min-height: 100vh; /* Sticky footer: Full viewport height */
}
.site-main {
  flex: 1 0 auto; /* Sticky footer: Grow to push footer down */
}
.site-footer {
  flex-shrink: 0; /* Sticky footer: Prevent shrinking */
}

/* ---------- Container ---------- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
}

/* ---------- Navbar ---------- */
.navbar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 15px;
  background: var(--navy);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 999;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 20px;
}
.brand-logo {
  color: var(--gold);
  font-weight: 800;
  font-size: 26px;
  line-height: 1;
}
.brand-text {
  color: var(--white);
  font-weight: 700;
  font-size: 18px;
}

/* Nav links */
.navbar-nav {
  display: flex;
  list-style: none;
  gap: 10px;
  margin: 0 20px;
  padding: 0;
  align-items: center;
}
.navbar-nav a {
  color: var(--white);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 16px;
  transition: background 0.2s ease, color 0.2s ease;
}
.navbar-nav a:hover {
  background: rgba(212,175,55,0.15);
  color: var(--gold);
}

/* Mobile nav toggle */
.mobile-nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  color: var(--white);
  font-size: 22px;
  cursor: pointer;
}

/* ---------- Hero ---------- */
.hero {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, #0056A3 100%);
  color: var(--white);
  position: relative;
  padding: 60px 0;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  z-index: 1;
}

.hero-inner {
  display: flex;
  gap: 40px;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: relative;
  z-index: 2;
}

/* Map container */
.hero-map-wrap {
  flex: 1 1 55%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  border-radius: 20px;
  overflow: visible;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  width: 100%; /* Ensure full width */
}
#map {
  width: 100%;
  height: 50vh;
  max-width: 100%;
  border-radius: 20px;
  position: relative;
  z-index: 2; /* Ensure map is above other elements */
}

/* Hero content */
.hero-content {
  flex: 1 1 45%;
  text-align: right;
  padding: 30px;
  background: rgba(255,255,255,0.05);
  border-radius: 15px;
  backdrop-filter: blur(5px);
}
.hero-title {
  font-size: clamp(32px, 5vw, 64px);
  line-height: 1.1;
  color: var(--white);
  margin: 0 0 15px;
  text-shadow: 0 3px 15px rgba(0,0,0,0.4);
}
.hero-sub {
  color: var(--gold-light);
  font-size: 20px;
  margin-bottom: 25px;
}
.hero-cta .btn {
  font-weight: 700;
  font-size: 18px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 50px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.btn-gold {
  background: var(--gold);
  color: var(--navy);
}
.btn-gold:hover {
  background: var(--gold-light);
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(212,175,55,0.3);
}
.btn-large {
  padding: 15px 30px;
  font-size: 20px;
}

/* ---------- Sections ---------- */
.section {
  padding: 80px 0;
  text-align: center;
}
.section--gradient {
  background: linear-gradient(180deg, var(--light-blue) 0%, var(--white) 100%);
}
.section--services {
  background: var(--white);
}
.section-title {
  font-size: clamp(28px, 4vw, 48px);
  color: var(--navy);
  margin: 0 0 40px;
  position: relative;
}
.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: var(--gold);
  margin: 10px auto 0;
}
.section-intro {
  max-width: 800px;
  margin: 0 auto 40px;
  font-size: 18px;
  color: var(--charcoal);
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
}
.stat-card {
  background: var(--white);
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.05);
  transition: transform 0.3s ease;
}
.stat-card:hover {
  transform: translateY(-5px);
}
.stat-icon {
  font-size: 40px;
  margin-bottom: 10px;
}
.stat-card h3 {
  color: var(--navy);
  margin: 10px 0 5px;
}
.stat-card p {
  color: var(--charcoal);
  font-size: 16px;
}

/* ---------- Cards & Grid ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
}
.card {
  background: var(--white);
  border: none;
  padding: 40px 20px;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.05);
  text-align: center;
  transition: all 0.3s ease;
}
.card:hover {
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  transform: translateY(-5px);
}
.card-icon {
  font-size: 50px;
  color: var(--gold);
  margin-bottom: 15px;
}
.card h3 {
  color: var(--navy);
  font-size: 24px;
  margin: 0 0 10px;
}
.card p {
  color: var(--charcoal);
  font-size: 16px;
}

/* ---------- CTA Section ---------- */
.section--cta {
  text-align: center;
  padding: 60px 0;
}
.cta-inner {
  max-width: 800px;
  margin: 0 auto;
}
.cta-title {
  font-size: 36px;
  color: var(--navy);
  margin: 0 0 20px;
}

/* ---------- Footer ---------- */
.site-footer {
  background: linear-gradient(180deg, var(--charcoal) 0%, #2A3A45 100%);
  color: var(--white);
  padding: 40px 0;
  margin-top: 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: start;
}
.footer-left h3 {
  margin: 0 0 10px;
  color: var(--gold);
}
.muted {
  color: var(--gold-light);
}
.footer-center p {
  margin: 5px 0;
}
.footer-center a {
  color: var(--gold);
  text-decoration: none;
}
.footer-center a:hover {
  color: var(--gold-light);
}
.social a {
  color: var(--gold);
  font-size: 24px;
  margin: 0 10px;
  transition: color 0.3s;
}
.social a:hover {
  color: var(--gold-light);
}
.copyright {
  font-size: 14px;
  color: var(--gold-light);
}

/* Blog Styles */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  margin-top: 20px;
}
.post-card {
  background: var(--white);
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.05);
  text-align: right;
  transition: all 0.3s ease;
}
.post-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
.post-card h3 {
  color: var(--navy);
  font-size: 22px;
  margin: 10px 0;
}
.post-card p {
  color: var(--charcoal);
  font-size: 16px;
  margin: 10px 0;
}
.post-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 15px;
}
.no-posts {
  font-size: 18px;
  color: var(--charcoal);
  text-align: center;
}
.post-detail {
  max-width: 800px;
  margin: 0 auto;
  text-align: right;
}
.post-title {
  font-size: clamp(28px, 4vw, 36px);
  color: var(--navy);
  margin: 0 0 10px;
}
.post-meta {
  font-size: 16px;
  color: var(--gold);
  margin-bottom: 20px;
}
.post-detail-image {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: 15px;
  margin-bottom: 20px;
}
.post-content {
  font-size: 18px;
  line-height: 1.6;
  color: var(--charcoal);
}
.post-content p {
  margin: 15px 0;
}

.post-button {
  display: block;
  margin: 30px auto; /* Keeps vertical space and centering */
  text-align: center;
  max-width: 200px; /* Smaller width for the button */
}
/*home page about and service buttons */
.section-button {
  display: block;
  margin: 30px auto; /* Centers and adds vertical spacing */
  max-width: 200px; /* Keeps button compact */
}

.social-icon {
  font-weight: bold; /* Makes LI and X bolder for clarity */
  font-size: 20px; /* Slightly larger if needed */
}
.designer-credit {
  font-size: 12px; /* Smaller font */
  color: #A9B7C0; /* Lighter charcoal, distinct from site content */
  margin-top: 10px; /* Reduced vertical space */
  text-align: right; /* RTL alignment (left in RTL context) */
}
.designer-credit a {
  color: #A9B7C0; /* Match text color */
  text-decoration: none;
  transition: color 0.3s ease;
}
.designer-credit a:hover {
  color: var(--gold-light); /* Gold hover for consistency */
}

.brand-logo {
  width: 50px; /* Adjust based on your logo size */
  height: auto;
  vertical-align: middle;
}

.messages {
  max-width: 800px;
  margin: 20px auto;
  text-align: center;
}
.message {
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 16px;
  font-family: "Vazir", sans-serif;
  color: var(--navy);
}
.message--success {
  background: var(--light-blue);
  border: 1px solid var(--gold);
}
/* Dashboard Styles */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  margin-top: 20px;
}
.messages-table-wrap {
  overflow-x: auto; /* Responsive table scrolling on small screens */
  margin-top: 20px;
}
.messages-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: 10px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}
.messages-table th, .messages-table td {
  padding: 12px 15px;
  text-align: right;
  font-family: "Vazir", sans-serif;
  font-size: 16px;
  color: var(--charcoal);
}
.messages-table th {
  background: var(--navy);
  color: var(--white);
  font-weight: 700;
}
.messages-table tr:nth-child(even) {
  background: var(--light-blue);
}
.messages-table td {
  border-bottom: 1px solid rgba(0,0,0,0.1);
}
.messages-table tr:last-child td {
  border-bottom: none;
}
.messages-table td:nth-child(3) { /* Targets the "پیام" column */
  max-width: 300px; /* Limits width to prevent table overflow */
  word-wrap: break-word; /* Wraps long text */
  white-space: normal; /* Allows text to wrap naturally */
}

.form-error {
  color: #D32F2F; /* Red for errors */
  font-size: 14px;
  margin-bottom: 5px;
  text-align: right;
  font-family: "Vazir", sans-serif;
}

.btn-danger {
  background: #D32F2F; /* Red for delete */
  color: var(--white);
}
.btn-danger:hover {
  background: #B71C1C; /* Darker red on hover */
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(211, 47, 47, 0.3);
}
.delete-form {
  display: inline; /* Keeps button inline with table */
}
.pagination {
  text-align: center;
  margin-top: 20px;
}
.pagination a, .pagination span {
  margin: 0 10px;
  font-size: 16px;
  color: var(--charcoal);
}
.pagination a {
  text-decoration: none;
}
.pagination a:hover {
  color: var(--gold);
}
/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .navbar {
    justify-content: space-between;
    padding: 10px 15px;
  }
  .brand {
    margin-left: 10px;
  }
  .navbar-nav {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--navy);
    flex-direction: column;
    padding: 10px 15px;
    align-items: center;
    text-align: center;
  }
  .navbar-nav.show {
    display: flex;
  }
  .mobile-nav-toggle {
    display: block;
  }
  .hero-inner {
    flex-direction: column;
    gap: 30px;
  }
  .hero-map-wrap {
    flex: 1 1 100%;
    padding: 20px;
    min-height: 40vh;
    width: 100%; /* Full width for mobile */
    max-width: none; /* Remove any max-width constraints */
  }
  #map {
    width: 100%;
    height: 40vh;
    max-width: none;
    border-radius: 15px;
    display: block; /* Ensure visibility */
    z-index: 2;
  }
  .hero-content {
    flex: 1 1 100%;
    padding: 20px;
  }
  .stats-grid, .cards-grid {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .social {
    margin: 10px 0;
  }
}

@media (min-width: 901px) {
  .mobile-nav-toggle {
    display: none;
  }
}

/* Map tooltip */
.map-tooltip {
  background: var(--white);
  border: 1px solid var(--navy);
  color: var(--charcoal);
  font-size: 14px;
  direction: rtl;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.map-popup .leaflet-popup-content {
  background: var(--white);
  border: 1px solid var(--navy);
  color: var(--charcoal);
  font-size: 14px;
  direction: rtl;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.map-popup .leaflet-popup-content a {
  color: var(--navy);
  text-decoration: underline;
  cursor: pointer;
}
.map-popup .leaflet-popup-content a:hover {
  color: var(--gold);
}

/* contact,about,services,case-studies.html*/
/* Contact form */
.contact-form-wrap {
  display: flex;
  gap: 30px;
  justify-content: center;
  flex-wrap: wrap;
}
.contact-form {
  flex: 1 1 50%;
  max-width: 600px;
  background: var(--white);
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}
.contact-form div {
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  padding: 0 10px;
}
.contact-form label {
  color: var(--navy);
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 8px;
  text-align: right;
}
.contact-form input, .contact-form textarea {
  box-sizing: border-box; /* Ensures padding/border included in width */
  width: 100%; /* Full width within container */
  max-width: 100%; /* Prevent overflow */
  padding: 12px 16px;
  border: 1px solid var(--charcoal);
  border-radius: 10px;
  font-family: "Vazir", sans-serif;
  font-size: 16px;
  background: var(--white);
  color: var(--charcoal);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.contact-form input:focus, .contact-form textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
  outline: none;
}
.contact-form textarea {
  resize: vertical;
  min-height: 120px;
}
.contact-form button {
  align-self: center;
  padding: 12px 30px;
  font-size: 16px;
  margin-top: 10px;
}
.contact-info {
  flex: 1 1 30%;
  max-width: 300px;
  text-align: right;
}
.contact-icon {
  font-size: 24px;
  color: var(--gold);
  margin-left: 10px;
}

/* Team section */
.team-section {
  margin-top: 40px;
  text-align: center;
}
.section-subtitle {
  font-size: 28px;
  color: var(--navy);
  margin: 0 0 20px;
}

/* Case study cards */
.case-card {
  padding: 30px;
}
.btn-small {
  padding: 8px 16px;
  font-size: 16px;
}

/* CTA section */
.cta-section {
  margin-top: 40px;
  text-align: center;
}