/* --- Basic Reset & Global Styles --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors */
    --color-primary: #81399c; /* Darkened for better contrast (5.5:1) */
    --color-primary-hover: #713189; /* Darkened for better hover contrast (6.8:1) */
    --color-secondary: #d35400; /* Darkened for better contrast (4.55:1 on white text) */
    --color-secondary-hover: #e67e22; /* Original secondary color becomes the hover state */
    --color-dark: #2c3e50;
    --color-medium: #34495e;
    --color-light: #f9f9f9;
    --color-white: #ffffff;
    --color-text: #333;
    --color-error: #e74c3c;

    /* Fonts */
    --font-primary: 'Montserrat', sans-serif;
    --font-headings: 'Playfair Display', serif;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    line-height: 1.6;
    background-color: var(--color-light);
    color: var(--color-text);
}

/* Hide content until the initial translation is applied to prevent FOUT */
body.translating {
    visibility: hidden;
}

body.nav-open {
    overflow: hidden;
}

body.rtl-layout {
    direction: rtl;
    text-align: right;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1, h2, h3 {
    font-family: var(--font-headings);
    color: var(--color-dark);
    margin-bottom: 20px;
}

h1 {
    font-size: 2.8em;
    text-align: center;
}

h2 {
    text-align: center;
    font-size: 2.5em;
    margin-bottom: 40px;
}

p {
    margin-bottom: 15px;
}

a {
    color: var(--color-primary); /* Default link color */
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    text-decoration: underline;
}

.text-center {
    text-align: center;
}

/* --- 2. Header (Logo & Top CTA) --- */
.header {
    background-color: var(--color-white);
    padding: 15px 20px; /* Use container padding */
    border-bottom: 1px solid #eee;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.header .logo {
    text-decoration: none;
    display: flex;
    align-items: center;
}
.header .logo:hover {
    text-decoration: none;
}
.header .logo img {
    height: 40px; /* Adjust this value to fit your logo's dimensions */
    width: auto;
}

.header .cta-button-top {
    background-color: var(--color-primary);
    color: var(--color-white);
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s ease;
    text-decoration: none;
}

.header .cta-button-top:hover {
    background-color: var(--color-primary-hover);
    text-decoration: none;
}

/* --- Language Switcher --- */
.lang-switcher {
    display: flex;
    gap: 5px;
    margin-left: 30px;
}
.lang-switcher button {
    background: none;
    border: 1px solid #ddd;
    border-radius: 5px; /* Rounded corners for the rectangle */
    padding: 3px; /* Small padding around the flag */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, color 0.3s;
    line-height: 0; /* Prevents extra space below the image */
}
.lang-switcher button img {
    width: 30px; /* Set a width for the flag */
    height: 20px; /* Set a height for the flag */
    border-radius: 2px; /* Slightly rounded corners for the flag image */
    pointer-events: none; /* Make sure clicks go to the button, not the image */
}
.lang-switcher button:hover {
    background-color: #f0f0f0;
}
.lang-switcher button.active {
    background-color: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

/* --- Header Navigation --- */
.main-nav ul {
    list-style: none;
    display: flex;
    gap: 30px;
    margin: 0;
    padding: 0;
}
.main-nav a {
    color: var(--color-medium);
    font-weight: bold;
    text-decoration: none;
    position: relative;
    padding-bottom: 5px;
    transition: color 0.3s ease;
}

/* Underline for hover and active states */
.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--color-primary);
    transform: scaleX(0); /* Initially hidden */
    transform-origin: center; /* Animation starts from the center */
    transition: transform 0.3s ease-out;
}

.main-nav a:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.main-nav a:hover::after {
    transform: scaleX(1); /* Show underline on hover */
}

/* Style for the active navigation link */
.main-nav a.active-link {
    color: var(--color-primary);
}

/* Add a prominent underline to the active link */
.main-nav a.active-link::after {
    transform: scaleX(1); /* Keep underline visible for active link */
}

body.rtl-layout .main-nav a {
    text-align: right;
}

/* --- Hamburger Menu --- */
.hamburger-menu {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001; /* Above header */
}

.hamburger-menu .bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: var(--color-text);
    transition: all 0.3s ease-in-out;
}

.nav-open .hamburger-menu .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.nav-open .hamburger-menu .bar:nth-child(2) {
    opacity: 0;
}

.nav-open .hamburger-menu .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}



/* --- 3. Hero Section --- */
.hero {
    /* Define background with WebP and PNG fallback */
    background: linear-gradient(rgba(44, 62, 80, 0.7), rgba(44, 62, 80, 0.7)),
                url('images/premium-qr-cube.webp'),
                url('images/premium-qr-cube.png');
    background-size: cover;
    background-position: center;
    color: var(--color-white);
    text-align: center;
    padding: 120px 20px;
}

.hero h1 {
    color: var(--color-white);
    font-size: 3.5em;
}

.hero p {
    font-size: 1.3em;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0.9;
}

.hero .cta-button-main {
    display: inline-block;
    margin-top: 20px;
    background-color: var(--color-secondary);
    color: var(--color-white);
    padding: 15px 30px;
    font-size: 1.2em;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s ease;
    text-decoration: none;
}

.hero .cta-button-main:hover {
    background-color: var(--color-secondary-hover);
    text-decoration: none;
}

.hero .pricing-hint {
    font-size: 0.9em;
    opacity: 0.8;
    margin-top: 15px;
    font-style: italic;
}

/* --- How It Works Section --- */
.how-it-works-steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-top: 50px;
    position: relative;
}

.how-it-works-steps::before {
    content: '';
    position: absolute;
    top: 30px;
    left: 12.5%;
    right: 12.5%;
    height: 2px;
    background-color: #ddd;
    z-index: -1;
}

.step {
    text-align: center;
    position: relative;
}

.step-number {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--color-white);
    border: 2px solid #ddd;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8em;
    font-weight: bold;
    margin: 0 auto 20px;
    transition: background-color 0.3s, border-color 0.3s;
}

.step h3 {
    font-size: 1.3em;
    color: var(--color-dark);
}

.step p {
    font-size: 0.95em;
    color: var(--color-medium);
}

.step:hover .step-number {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-white);
}

body.rtl-layout .how-it-works-steps::before {
    left: 12.5%;
    right: 12.5%;
}

/* --- 4, 5, 6. Section & Grid Styles --- */
.section {
    padding: 60px 0;
    border-bottom: 1px solid #eee;
}

.section:nth-of-type(even) {
    background-color: #f2f4f6;
}

.grid-3-col {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Default to 3 columns */
    gap: 30px;
}

.grid-item {
    background-color: var(--color-white);
    padding: 30px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.grid-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.grid-item .icon {
    color: var(--color-primary);
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    font-size: 48px; /* Set a consistent size for the icons */
}

.grid-item img {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 20px;
}

.portfolio-item {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.portfolio-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}
.portfolio-item img {
    width: 100%;
    display: block;
}

/* --- 7. Testimonials Section --- */
.testimonial-card {
    background-color: var(--color-white);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
    font-style: italic;
}

.testimonial-card p {
    font-size: 1.1em;
    margin-bottom: 20px;
}

.testimonial-card .author {
    font-weight: bold;
    font-style: normal;
    text-align: right;
    color: var(--color-medium);
}

.testimonial-placeholder {
    max-width: 700px;
    margin: 0 auto;
    background-color: var(--color-white);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
    text-align: center;
    font-style: italic;
    color: var(--color-medium);
    font-size: 1.1em;
}

/* --- 9. FAQ Section --- */
.faq-list {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background-color: var(--color-white);
    margin-bottom: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden; /* To contain the answer */
}

.faq-item h3 {
    margin: 0;
    font-size: 1.2em; /* Keep font size consistent */
    font-family: var(--font-headings); /* Inherit from h3 */
    font-weight: normal; /* Buttons are bold by default */
}

.faq-item .faq-question-button {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font: inherit; /* Inherit font styles from h3 */
    padding: 20px;
    color: var(--color-medium);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item .faq-question-button::after {
    content: '+';
    font-family: var(--font-primary);
    font-size: 1.5em;
    color: var(--color-primary);
    transition: transform 0.3s ease;
}

.faq-item.active .faq-question-button::after {
    transform: rotate(45deg);
}

.faq-item .answer {
    max-height: 0;
    overflow: hidden;
    padding: 0 20px;
    border-top: 1px solid #eee;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
}

/* --- 10. Contact Form --- */
.contact-form fieldset {
    border: 1px solid #ddd;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}
.contact-form legend {
    padding: 0 10px;
    font-weight: bold;
    color: var(--color-medium);
    font-size: 1.1em;
}
/* --- 10. Contact Form --- */
.contact-form {
    max-width: 700px;
    margin: 40px auto 0;
    text-align: left;
}
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--color-medium);
}
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-family: var(--font-primary);
    font-size: 1em;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(142, 68, 173, 0.2);
}
.form-group textarea {
    resize: vertical;
    min-height: 120px;
}
.link-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.submit-button {
    background-color: var(--color-primary); /* Use secondary brand color */
    width: 100%;
    cursor: pointer;
    border: none;
    box-shadow: 0 4px 15px rgba(142, 68, 173, 0.2);
    padding: 18px 30px; /* Increased padding for height */
    border-radius: 8px; /* Softer, more modern corners */
    font-weight: bold; /* Make text more prominent */
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.submit-button:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-3px);
    box-shadow: 0 7px 20px rgba(142, 68, 173, 0.3);
}
.submit-button:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(142, 68, 173, 0.3);
}

/* Spinner for the submit button */
.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-white);
    border-radius: 50%;
    display: none; /* Hidden by default */
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* When the button is in a loading state */
.submit-button.loading .spinner {
    display: block;
}
.submit-button.loading .button-text {
    display: none;
}
.submit-button:disabled {
    background-color: var(--color-primary-hover);
    cursor: not-allowed;
}
.form-group .error-message {
    color: var(--color-error); /* A reddish error color */
    font-size: 0.85em;
    display: none; /* Hidden by default */
    margin-top: 5px;
}

.form-group input.invalid,
.form-group textarea.invalid {
    border-color: var(--color-error);
}

.form-group input.invalid:focus,
.form-group textarea.invalid:focus {
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
}

.form-hint {
    font-size: 0.85em;
    color: #555;
    margin-top: -10px;
    margin-bottom: 15px;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

#form-success-message {
    display: none; /* Hidden by default */
    padding: 40px;
    background-color: #f2f4f6;
    border: 2px solid #2ecc71;
    border-radius: 8px;
    text-align: center;
}
#form-success-message h3 {
    color: #27ae60;
}
#form-success-message p {
    font-size: 1.1em;
}

body.rtl-layout .contact-form {
    text-align: right;
}

/* --- Materials Section --- */
.material-showcase {
    display: flex;
    align-items: center;
    gap: 50px;
    margin-top: 40px;
}

.material-image {
    flex: 1;
    min-width: 0; /* Prevents flex item from overflowing */
}

.material-image img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.material-details {
    flex: 1;
    text-align: left;
}

.material-details h3 {
    font-size: 1.8em;
}

body.rtl-layout .material-details { text-align: right; }


/* --- Scroll Animations --- */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Back to Top Button --- */
#back-to-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999;
    background-color: var(--color-primary);
    color: var(--color-white);
    cursor: pointer;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out, transform 0.3s ease-in-out;
}

#back-to-top-btn.show {
    opacity: 1;
    visibility: visible;
}

/* --- 11. Footer --- */
.footer {
    background-color: var(--color-dark);
    color: #bdc3c7;
    padding: 60px 0;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 40px;
}

.footer-brand, .footer-links, .footer-contact {
    flex: 1;
    min-width: 200px;
}

.footer h3, .footer h4 {
    color: var(--color-white);
    font-family: var(--font-headings);
    margin-bottom: 15px;
}

.footer h3 {
    font-size: 1.5em;
}

.footer h4 {
    font-size: 1.2em;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer a {
    color: #bdc3c7;
}

.footer a:hover {
    color: #ecf0f1;
    text-decoration: underline;
}

.footer-logo img {
    height: 45px;
    width: auto;
    margin-bottom: 15px;
    /* This filter will make the purple logo appear white */
    filter: brightness(0) invert(1) grayscale(1) brightness(2);
}

body.rtl-layout .footer-brand {
    text-align: right;
}
/* --- Lightbox Styles --- */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox-overlay.show {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    border-radius: 5px;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.lightbox-close, .lightbox-prev, .lightbox-next {
    position: absolute;
    background: none;
    border: none;
    color: var(--color-white);
    cursor: pointer;
    font-size: 2.5em;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    padding: 10px;
    z-index: 2001;
}

.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover {
    opacity: 1;
}

.lightbox-close {
    top: 15px;
    right: 25px;
    font-size: 3em;
}

.lightbox-prev, .lightbox-next {
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-prev { left: 15px; }
.lightbox-next { right: 15px; }

body.lightbox-open { overflow: hidden; }

/* --- Media Queries for Responsiveness --- */
@media (max-width: 768px) {
    h1 { font-size: 2.2em; }
    .hero h1 { font-size: 2.5em; }
    .hero p { font-size: 1.1em; }

    body.rtl-layout .header {
        flex-direction: row-reverse;
    }
    body.rtl-layout .lang-switcher { margin-left: 0; margin-right: 15px; }

    /* Keep header items in a row and adjust spacing for mobile */
    .header {
        padding: 10px 15px; /* Reduce padding on mobile */
    }

    .header .logo {
        font-size: 1.5em; /* Adjust logo size for mobile */
    }

    .header .logo img {
        height: 35px; /* Slightly smaller logo on mobile */
    }

    .grid-3-col {
        grid-template-columns: 1fr;
    }
    .link-fields-grid {
        grid-template-columns: 1fr;
    }
    .material-showcase {
        flex-direction: column;
        gap: 30px;
    }
    .material-details {
        text-align: center;
    }
    body.rtl-layout .material-details { text-align: center; }
    body.rtl-layout .main-nav ul {
        align-items: flex-end;
        padding-right: 20px;
    }
    .hamburger-menu {
        display: block;
    }

    .main-nav {
        position: fixed;
        top: 0;
        left: 100%;
        width: 100%;
        height: 100vh;
        background-color: rgba(255, 255, 255, 0.98); /* var(--color-white) with alpha */
        backdrop-filter: blur(5px);
        display: flex;
        justify-content: center;
        align-items: center;
        transition: left 0.4s ease-in-out;
        z-index: 1000;
    }

    .nav-open .main-nav {
        left: 0;
    }

    .main-nav ul {
        flex-direction: column;
        text-align: center;
        gap: 40px;
    }

    .main-nav a {
        font-size: 1.5em;
    }
    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .header .cta-button-top {
        display: none; /* Hide top CTA button on mobile to save space */
    }

    .how-it-works-steps {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .how-it-works-steps::before {
        top: 30px;
        bottom: 30px;
        left: 50%;
        transform: translateX(-50%);
        width: 2px;
        height: auto;
    }

    /* Adjust grid for tablets */
    @media (max-width: 992px) {
        .grid-3-col {
            grid-template-columns: repeat(2, 1fr); /* 2 columns for tablets */
        }
    }

    /* This already handles mobile, but adding a comment for clarity */
    /* On screens smaller than 768px, it becomes 1 column due to the existing rule below */
}