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

:root {
   /* Colors */
   --bg-light: #f0f4f8;
   --bg-dark: #0d0f16;
   --text-light: #111111;
   --text-dark: #f1f1f1;

   /* Glassmorphism */
   --glass-bg-light: rgba(255, 255, 255, 0.65);
   --glass-bg-dark: rgba(22, 24, 35, 0.65);
   --glass-border-light: rgba(255, 255, 255, 0.4);
   --glass-border-dark: rgba(255, 255, 255, 0.1);
   --glass-blur: 20px;
   --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);

   /* Brand Gradients */
   --gradient-primary: linear-gradient(135deg, #00c6a9 0%, #0078d7 100%); /* Teal -> Blue */
   --gradient-accent: linear-gradient(135deg, #ff9966 0%, #ff5e62 100%); /* Orange -> Red */
   --gradient-text: linear-gradient(135deg, #0078d7, #00c6a9);

   /* Dimensions */
   --radius: 20px;
   --transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
   --header-height: 80px;
}

/* Default Theme (Light) */
body {
   background: var(--bg-light);
   color: var(--text-light);
   font-family: "Noto Sans Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
   transition: background var(--transition), color var(--transition);
   overflow-x: hidden;
   min-height: 100vh;
}

/* Dark Theme */
[data-theme="dark"] body {
   background: var(--bg-dark);
   color: var(--text-dark);
}

/* Background Blobs for Premium Feel */
body::before,
body::after {
   content: "";
   position: fixed;
   width: 40vw;
   height: 40vw;
   border-radius: 50%;
   filter: blur(80px);
   z-index: -1;
   opacity: 0.4;
   animation: float 10s infinite alternate;
}

body::before {
   background: #00c6a9;
   top: -10%;
   left: -10%;
}

body::after {
   background: #0078d7;
   bottom: -10%;
   right: -10%;
   animation-delay: -5s;
}

@keyframes float {
   0% {
      transform: translate(0, 0);
   }
   100% {
      transform: translate(30px, 50px);
   }
}

/* ====== UTILITIES ====== */
.container {
   max-width: 1200px;
   margin: auto;
   padding: 0 20px;
}

.glass-card {
   background: var(--glass-bg-light);
   backdrop-filter: blur(var(--glass-blur));
   -webkit-backdrop-filter: blur(var(--glass-blur));
   border: 1px solid var(--glass-border-light);
   border-radius: var(--radius);
   box-shadow: var(--glass-shadow);
   padding: 30px;
   transition: var(--transition);
}

[data-theme="dark"] .glass-card {
   background: var(--glass-bg-dark);
   border-color: var(--glass-border-dark);
}

.glass-card:hover {
   transform: translateY(-5px);
   box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.25);
}

.btn-primary {
   background: var(--gradient-primary);
   color: white;
   border: none;
   padding: 12px 24px;
   border-radius: 50px;
   font-weight: 600;
   cursor: pointer;
   text-decoration: none;
   text-align: center;
   display: inline-block;
   transition: var(--transition);
   box-shadow: 0 4px 15px rgba(0, 120, 215, 0.3);
   /* Ensure consistency between <button> and <a> */
   font-family: inherit;
   font-size: 1rem;
   line-height: 1.5;
}

.btn-primary:hover {
   transform: scale(1.05);
   box-shadow: 0 6px 20px rgba(0, 120, 215, 0.4);
}

.text-gradient {
   background: var(--gradient-text);
   -webkit-background-clip: text;
   -webkit-text-fill-color: transparent;
   background-clip: text;
}

/* ====== HEADER ====== */
header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   height: var(--header-height);
   position: sticky;
   top: 0;
   z-index: 100;
   backdrop-filter: blur(10px);
   -webkit-backdrop-filter: blur(10px);
   border-bottom: 1px solid rgba(255, 255, 255, 0.1);
   padding: 0 20px;
}

header img {
   height: 40px;
}

.menu {
   display: flex;
   gap: 12px;
}

button.switch {
   padding: 8px 16px;
   border: 1px solid rgba(255, 255, 255, 0.2);
   background: rgba(255, 255, 255, 0.1);
   color: inherit;
   border-radius: 20px;
   cursor: pointer;
   transition: var(--transition);
   backdrop-filter: blur(5px);
   text-align: center;
}

button.switch:hover {
   background: rgba(255, 255, 255, 0.2);
}

/* ====== HERO ====== */
.hero {
   text-align: center;
   padding: 100px 20px;
}

.hero h1 {
   font-size: 3.5rem;
   font-weight: 800;
   margin-bottom: 15px;
   line-height: 1.2;
}

.hero p {
   font-size: 1.2rem;
   opacity: 0.8;
   max-width: 600px;
   margin: 0 auto;
}

/* ====== HORIZONTAL SCROLL SECTIONS (App Store Style) ====== */
.scroll-section {
   margin: 40px 0;
}

.section-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   margin-bottom: 20px;
   padding: 0 20px;
}

.section-title {
   font-size: 1.5rem;
   font-weight: 700;
}

.scroll-container {
   display: flex;
   gap: 20px;
   overflow-x: auto;
   padding: 10px 20px 40px 20px; /* Bottom padding for shadow */
   scroll-snap-type: x mandatory;
   -webkit-overflow-scrolling: touch;
}

.scroll-container::-webkit-scrollbar {
   display: none;
}

.app-card {
   width: 400px;
   max-width: 85vw;
   scroll-snap-align: start;
   display: flex;
   flex-direction: column;
   justify-content: space-between;
   min-height: 300px;
   height: auto;
   gap: 20px;
   flex-shrink: 0;
   height: 100%; /* Ensure cards stretch to fill the container height */
}

.app-card .btn-primary {
   flex-shrink: 0; /* Prevent button from shrinking if content is long */
   margin-top: auto; /* Push button to the bottom */
}

.app-icon {
   width: 80px;
   height: 80px;
   border-radius: 18px;
   margin-bottom: 15px;
   object-fit: cover;
   box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.app-info h3 {
   font-size: 1.4rem;
   margin-bottom: 5px;
}

.app-info p {
   opacity: 0.7;
   font-size: 0.95rem;
   line-height: 1.4;
}

/* ====== FOOTER ====== */
footer {
   text-align: center;
   padding: 40px 20px;
   opacity: 0.6;
   font-size: 0.9rem;
   margin-top: 60px;
}

footer a {
   color: inherit;
   text-decoration: none;
   margin: 0 10px;
}

footer a:hover {
   text-decoration: underline;
}

/* ====== RTL SUPPORT ====== */
html[dir="rtl"] body {
   direction: rtl;
   text-align: right;
   font-family: "Noto Sans Arabic", sans-serif;
}

html[dir="rtl"] .scroll-container {
   flex-direction: row; /* Flex direction handles RTL automatically */
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
   .hero h1 {
      font-size: 2.5rem;
   }

   .app-card {
      min-height: 300px;
   }
}

/* ====== LANGUAGE SELECTOR MODAL ====== */
.lang-modal-overlay {
   position: fixed;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background: rgba(0, 0, 0, 0.5);
   backdrop-filter: blur(5px);
   z-index: 1000;
   display: none;
   justify-content: center;
   align-items: center;
   opacity: 0;
   transition: opacity 0.3s ease;
}

.lang-modal-overlay.active {
   display: flex;
   opacity: 1;
}

.lang-modal {
   background: var(--bg-light);
   padding: 30px;
   border-radius: var(--radius);
   width: 90%;
   max-width: 500px;
   box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
   transform: scale(0.9);
   transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="dark"] .lang-modal {
   background: var(--bg-dark);
   border: 1px solid var(--glass-border-dark);
}

.lang-modal-overlay.active .lang-modal {
   transform: scale(1);
}

.lang-grid {
   display: grid;
   grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
   gap: 15px;
   margin-top: 20px;
}

.lang-btn {
   background: rgba(0, 0, 0, 0.05);
   border: 1px solid transparent;
   padding: 15px;
   border-radius: 12px;
   cursor: pointer;
   text-align: center;
   transition: var(--transition);
   font-weight: 600;
   color: var(--text-light);
}

[data-theme="dark"] .lang-btn {
   background: rgba(255, 255, 255, 0.05);
   color: var(--text-dark);
}

.lang-btn:hover,
.lang-btn.active {
   background: var(--gradient-primary);
   color: white;
   transform: translateY(-2px);
   box-shadow: 0 5px 15px rgba(0, 120, 215, 0.3);
}

.modal-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   margin-bottom: 10px;
}

.close-modal {
   background: none;
   border: none;
   font-size: 1.5rem;
   cursor: pointer;
   color: var(--text-light);
}

[data-theme="dark"] .close-modal {
   color: var(--text-dark);
}

/* ====== PHARMAPAL LANDING STYLES ====== */
.hero-app {
   display: flex;
   align-items: center;
   justify-content: space-between;
   padding: 80px 20px;
   gap: 40px;
   text-align: left;
}

html[dir="rtl"] .hero-app {
   text-align: right;
}

.hero-content {
   flex: 1;
   max-width: 600px;
}

.hero-image {
   flex: 1;
   display: flex;
   justify-content: center;
}

.hero-image img {
   max-width: 300px;
   border-radius: 40px;
   box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
   transform: rotate(-5deg);
   transition: var(--transition);
}

html[dir="rtl"] .hero-image img {
   transform: rotate(5deg);
}

.hero-image img:hover {
   transform: rotate(0deg) scale(1.05);
}

.features-grid {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
   gap: 30px;
   margin: 60px 0;
}

.feature-card {
   text-align: center;
   padding: 40px 30px;
}

.feature-icon {
   font-size: 3rem;
   margin-bottom: 20px;
   display: inline-block;
   background: var(--gradient-primary);
   -webkit-background-clip: text;
   background-clip: text;
   -webkit-text-fill-color: transparent;
}

.premium-section {
   text-align: center;
   margin: 80px 0;
}

.pricing-card {
   max-width: 400px;
   margin: 40px auto;
   position: relative;
   overflow: hidden;
}

.pricing-card::before {
   content: "PREMIUM";
   position: absolute;
   top: 20px;
   right: -30px;
   background: var(--gradient-accent);
   color: white;
   padding: 5px 40px;
   transform: rotate(45deg);
   font-size: 0.8rem;
   font-weight: bold;
   box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

html[dir="rtl"] .pricing-card::before {
   right: auto;
   left: -30px;
   transform: rotate(-45deg);
}

.download-buttons {
   display: flex;
   gap: 20px;
   margin-top: 30px;
}

.store-btn {
   background: black;
   color: white;
   padding: 10px 20px;
   border-radius: 10px;
   display: flex;
   align-items: center;
   gap: 10px;
   text-decoration: none;
   transition: var(--transition);
}

.store-btn:hover {
   transform: translateY(-3px);
   box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
   .hero-app {
      flex-direction: column;
      text-align: center;
   }

   html[dir="rtl"] .hero-app {
      text-align: center;
   }

   .hero-content {
      margin: 0 auto;
   }

   .download-buttons {
      justify-content: center;
   }
}

/* ====== GENERIC RTL OVERRIDES ====== */
html[dir="rtl"] .text-left {
   text-align: right;
}

html[dir="rtl"] ul {
   padding-right: 20px;
   padding-left: 0;
}

html[dir="rtl"] .pricing-card ul {
   text-align: right !important;
}

/* ====== LEGAL PAGES STYLES ====== */
.legal-container {
   padding: 40px 20px;
   max-width: 900px;
   margin: 0 auto;
}

.legal-header {
   text-align: center;
   margin-bottom: 40px;
   border-bottom: 1px solid rgba(255, 255, 255, 0.1);
   padding-bottom: 30px;
}

.legal-title {
   font-size: 2.5rem;
   font-weight: 800;
   margin-bottom: 10px;
}

.legal-subtitle {
   font-size: 1.2rem;
   opacity: 0.7;
}

.legal-updated {
   text-align: center;
   margin-bottom: 40px;
   font-weight: 600;
   color: #ff9966; /* Accent color */
}

.legal-section {
   margin-bottom: 40px;
}

.legal-section h2 {
   font-size: 1.8rem;
   margin-bottom: 20px;
   color: var(--text-light);
}

[data-theme="dark"] .legal-section h2 {
   color: var(--text-dark);
}

.legal-section h3 {
   font-size: 1.4rem;
   margin: 25px 0 15px 0;
   opacity: 0.9;
}

.legal-section p {
   line-height: 1.8;
   margin-bottom: 15px;
   opacity: 0.8;
}

.legal-section ul {
   margin-bottom: 20px;
   padding-left: 20px;
}

.legal-section li {
   margin-bottom: 10px;
   line-height: 1.6;
   opacity: 0.8;
}

.highlight-box {
   background: rgba(255, 153, 102, 0.1);
   border-left: 4px solid #ff9966;
   padding: 20px;
   border-radius: 10px;
   margin: 30px 0;
}

.contact-box {
   background: rgba(0, 198, 169, 0.1);
   border: 1px solid rgba(0, 198, 169, 0.3);
   padding: 30px;
   border-radius: var(--radius);
   margin-top: 50px;
}

/* ====== LEGAL PAGES RTL OVERRIDES ====== */
html[dir="rtl"] .legal-section ul {
   padding-right: 20px;
   padding-left: 0;
}

html[dir="rtl"] .highlight-box {
   border-left: none;
   border-right: 4px solid #ff9966;
}

html[dir="rtl"] .legal-header,
html[dir="rtl"] .legal-section h2,
html[dir="rtl"] .legal-section h3,
html[dir="rtl"] .legal-section p,
html[dir="rtl"] .legal-section li {
   text-align: right;
}

/* FAQ Specifics */
.faq-item {
   background: rgba(255, 255, 255, 0.05);
   border: 1px solid rgba(255, 255, 255, 0.1);
   border-radius: 15px;
   padding: 25px;
   margin-bottom: 20px;
   transition: var(--transition);
}

.faq-item:hover {
   background: rgba(255, 255, 255, 0.1);
   transform: translateY(-2px);
}

.faq-question {
   font-weight: 700;
   font-size: 1.1rem;
   margin-bottom: 15px;
   color: #00c6a9;
}

.faq-answer {
   line-height: 1.6;
   opacity: 0.9;
}

html[dir="rtl"] .faq-question,
html[dir="rtl"] .faq-answer {
   text-align: right;
}
