/* ═══════════════════════════════════════════════════════════════
   Merandoo Public Pages — Shared Design System
   Primary: Teal #104B5F (matches business app theme)
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ── */
:root {
    --m-primary: #104B5F;
    --m-primary-light: #1F759B;
    --m-primary-dark: #0A2530;
    --m-primary-surface: rgba(16, 75, 95, 0.08);

    --m-bg: #F8FAFB;
    --m-surface: #ffffff;
    --m-surface-dim: #EFF3F5;
    --m-text: #1A2B33;
    --m-text-secondary: #4A6572;
    --m-muted: #7E9AA8;
    --m-border: #D6E2E8;
    --m-border-light: rgba(16, 75, 95, 0.1);

    --m-success: #16644B;
    --m-success-bg: #E8F5EE;
    --m-warning: #D97706;
    --m-warning-bg: #FFFBEB;
    --m-error: #DC2626;
    --m-error-bg: #FEF2F2;

    --m-shadow-xs: 0 1px 2px rgba(10, 37, 48, 0.04);
    --m-shadow-sm: 0 2px 8px rgba(10, 37, 48, 0.06);
    --m-shadow: 0 4px 16px rgba(10, 37, 48, 0.08);
    --m-shadow-lg: 0 8px 32px rgba(10, 37, 48, 0.12);
    --m-shadow-xl: 0 16px 48px rgba(10, 37, 48, 0.16);

    --m-radius-sm: 8px;
    --m-radius: 12px;
    --m-radius-lg: 16px;
    --m-radius-xl: 24px;
    --m-radius-full: 9999px;

    --m-transition: 0.2s ease;
    --m-transition-slow: 0.3s ease;
}

/* Dark mode */
.dark-mode {
    --m-primary: #3DA5C9;
    --m-primary-light: #5BBDE0;
    --m-primary-dark: #1F759B;
    --m-primary-surface: rgba(61, 165, 201, 0.1);

    --m-bg: #0D1B22;
    --m-surface: #152833;
    --m-surface-dim: #1A3040;
    --m-text: #E0EBF0;
    --m-text-secondary: #9AB5C4;
    --m-muted: #6A8D9E;
    --m-border: #2A4A58;
    --m-border-light: rgba(61, 165, 201, 0.12);

    --m-success: #4EC89A;
    --m-success-bg: rgba(78, 200, 154, 0.12);
    --m-warning: #FBBF24;
    --m-warning-bg: rgba(251, 191, 36, 0.12);
    --m-error: #F87171;
    --m-error-bg: rgba(248, 113, 113, 0.12);
}

/* ── Base Reset ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

/* ── Typography ── */
body.m-public {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--m-bg);
    color: var(--m-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Navigation ── */
.m-nav {
    background: var(--m-primary);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(10, 37, 48, 0.15);
}

.m-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.m-nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.01em;
}

.m-nav-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.m-nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.m-nav-links a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--m-radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--m-transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.m-nav-links a .material-icons {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.85) !important;
}

.m-nav-links a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.m-nav-links a.active {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-weight: 600;
}

.m-nav-cta {
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--m-radius-full) !important;
    padding: 8px 20px !important;
    font-weight: 600 !important;
}

.m-nav-cta:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.4);
}

.m-nav-icon-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--m-transition);
}

.m-nav-icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.m-nav-icon-btn .material-icons {
    font-size: 22px;
    color: rgba(255, 255, 255, 0.85) !important;
}

/* Mobile nav */
.m-nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

.m-nav-toggle .material-icons {
    font-size: 28px;
    color: #fff !important;
}

@media (max-width: 768px) {
    .m-nav-toggle {
        display: flex;
    }

    .m-nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--m-primary);
        flex-direction: column;
        padding: 8px 16px 16px;
        gap: 4px;
        box-shadow: var(--m-shadow-lg);
    }

    .m-nav-links.open {
        display: flex;
    }

    .m-nav-links a {
        width: 100%;
        padding: 12px 16px;
    }
}

/* ── Container ── */
.m-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.m-container-sm {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
}

.m-container-xs {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ── Section ── */
.m-section {
    padding: 80px 0;
}

.m-section-alt {
    padding: 80px 0;
    background: var(--m-surface);
}

.m-section-title {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--m-text);
    text-align: center;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.m-section-subtitle {
    font-size: 1.1rem;
    color: var(--m-text-secondary);
    text-align: center;
    max-width: 600px;
    margin: 0 auto 48px;
    line-height: 1.6;
}

/* ── Cards ── */
.m-card {
    background: var(--m-surface);
    border: 1px solid var(--m-border-light);
    border-radius: var(--m-radius-lg);
    box-shadow: var(--m-shadow-sm);
    overflow: hidden;
    transition: all var(--m-transition-slow);
}

.m-card:hover {
    box-shadow: var(--m-shadow);
    transform: translateY(-4px);
    border-color: var(--m-primary);
}

.m-card-body {
    padding: 24px;
}

/* ── Buttons ── */
.m-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--m-radius);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--m-transition);
    text-decoration: none;
    white-space: nowrap;
}

.m-btn .material-icons {
    font-size: 20px;
}

.m-btn-primary {
    background: var(--m-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(16, 75, 95, 0.2);
}

.m-btn-primary:hover {
    background: var(--m-primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(16, 75, 95, 0.25);
}

.m-btn-primary .material-icons {
    color: #fff !important;
}

.m-btn-secondary {
    background: var(--m-surface);
    color: var(--m-primary);
    border: 1.5px solid var(--m-primary);
}

.m-btn-secondary:hover {
    background: var(--m-primary-surface);
    transform: translateY(-1px);
}

.m-btn-secondary .material-icons {
    color: var(--m-primary) !important;
}

.m-btn-white {
    background: #fff;
    color: var(--m-primary-dark);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.m-btn-white:hover {
    background: #f8fafb;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.m-btn-white .material-icons {
    color: var(--m-primary-dark) !important;
}

.m-btn-ghost {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.m-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.m-btn-ghost .material-icons {
    color: #fff !important;
}

.m-btn-lg {
    padding: 14px 32px;
    font-size: 1.05rem;
}

/* ── Badges / Chips ── */
.m-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--m-radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.m-badge-primary {
    background: var(--m-primary-surface);
    color: var(--m-primary);
}

.m-badge-success {
    background: var(--m-success-bg);
    color: var(--m-success);
}

.m-badge-warning {
    background: var(--m-warning-bg);
    color: var(--m-warning);
}

.m-badge-error {
    background: var(--m-error-bg);
    color: var(--m-error);
}

/* ── Footer ── */
.m-footer {
    border-top: 1px solid var(--m-border-light);
    background: var(--m-surface);
}

.m-footer-top {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 24px 32px;
    display: grid;
    grid-template-columns: 1.6fr repeat(4, 1fr);
    gap: 32px;
}

.m-footer-brand-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.m-footer-brand {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--m-text);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.m-footer-brand .material-icons {
    font-size: 24px;
    color: var(--m-primary) !important;
}

.m-footer-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.m-footer-tagline {
    font-size: 0.85rem;
    color: var(--m-muted);
    line-height: 1.5;
    max-width: 280px;
}

.m-footer-apps {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.m-app-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--m-surface-dim);
    border: 1px solid var(--m-border-light);
    border-radius: var(--m-radius-sm);
    color: var(--m-text);
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 500;
    transition: all var(--m-transition);
}

.m-app-badge:hover {
    border-color: var(--m-primary);
    color: var(--m-primary);
}

.m-app-badge svg {
    flex-shrink: 0;
}

.m-footer-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.m-footer-heading {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--m-text);
    margin-bottom: 4px;
}

.m-footer-col a {
    color: var(--m-text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    transition: color var(--m-transition);
}

.m-footer-col a:hover {
    color: var(--m-primary);
}

.m-footer-social {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.m-social-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--m-surface-dim);
    border: 1px solid var(--m-border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--m-text-secondary);
    text-decoration: none;
    transition: all var(--m-transition);
}

.m-social-icon:hover {
    background: var(--m-primary);
    border-color: var(--m-primary);
    color: #fff;
}

.m-footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 24px;
    border-top: 1px solid var(--m-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.m-footer-copy {
    color: var(--m-muted);
    font-size: 0.82rem;
}

.m-footer-lang {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--m-text-secondary);
}

.m-footer-lang select {
    background: var(--m-surface-dim);
    border: 1px solid var(--m-border-light);
    color: var(--m-text-secondary);
    font-size: 0.82rem;
    font-family: inherit;
    padding: 4px 8px;
    border-radius: var(--m-radius-sm);
    cursor: pointer;
    outline: none;
}

.m-footer-lang select:focus {
    border-color: var(--m-primary);
}

@media (max-width: 768px) {
    .m-footer-top {
        grid-template-columns: 1fr 1fr;
        gap: 28px;
    }

    .m-footer-brand-col {
        grid-column: 1 / -1;
    }

    .m-footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    .m-section {
        padding: 48px 0;
    }

    .m-section-alt {
        padding: 48px 0;
    }

    .m-section-title {
        font-size: 1.75rem;
    }

    .m-section-subtitle {
        font-size: 1rem;
        margin-bottom: 32px;
    }
}

/* ── Utilities ── */
.m-text-center {
    text-align: center;
}

.m-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.m-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.m-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

@media (max-width: 1024px) {
    .m-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .m-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {

    .m-grid-2,
    .m-grid-3,
    .m-grid-4 {
        grid-template-columns: 1fr;
    }
}

/* ── Animations ── */
@keyframes m-fade-up {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes m-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes m-scale-in {
    from {
        opacity: 0;
        transform: scale(0.92);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Scroll-triggered: hidden by default, revealed by IntersectionObserver */
.m-animate {
    opacity: 0;
    transform: translateY(24px);
}

.m-animate.m-visible {
    animation: m-fade-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.m-animate-delay-1.m-visible {
    animation-delay: 0.08s;
}

.m-animate-delay-2.m-visible {
    animation-delay: 0.16s;
}

.m-animate-delay-3.m-visible {
    animation-delay: 0.24s;
}

.m-animate-delay-4.m-visible {
    animation-delay: 0.32s;
}

/* Reduced motion: disable all animations */
@media (prefers-reduced-motion: reduce) {

    .m-animate,
    .m-animate.m-visible {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Button Active/Press States ── */
.m-btn:active {
    transform: scale(0.97);
}

.m-btn-primary:active {
    box-shadow: 0 1px 4px rgba(16, 75, 95, 0.15);
}

.m-card:active {
    transform: scale(0.985);
}

.m-social-icon:active {
    transform: scale(0.9);
}

/* Social brand colors on hover */
.m-social-linkedin:hover {
    background: #0A66C2;
    border-color: #0A66C2;
    color: #fff;
}

.m-social-instagram:hover {
    background: #E4405F;
    border-color: #E4405F;
    color: #fff;
}

.m-social-x:hover {
    background: #14171A;
    border-color: #14171A;
    color: #fff;
}

.m-social-youtube:hover {
    background: #FF0000;
    border-color: #FF0000;
    color: #fff;
}

.m-social-facebook:hover {
    background: #1877F2;
    border-color: #1877F2;
    color: #fff;
}

/* ── Dark mode overrides for components ── */
.dark-mode .m-nav {
    background: #0A2530;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.dark-mode .m-nav-links {
    background: #0A2530;
}

.dark-mode .m-btn-primary {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dark-mode .m-btn-primary:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.dark-mode .m-btn-white {
    background: var(--m-surface);
    color: var(--m-text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dark-mode .m-btn-white:hover {
    background: var(--m-surface-dim);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.dark-mode .m-btn-white .material-icons {
    color: var(--m-text) !important;
}

.dark-mode .m-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.dark-mode .m-footer {
    background: #0A2530;
}

.dark-mode .m-social-icon {
    background: var(--m-surface);
}

.dark-mode .m-social-x:hover {
    background: #E7E9EA;
    border-color: #E7E9EA;
    color: #14171A;
}

.dark-mode .m-app-badge {
    background: var(--m-surface);
}

/* Dark mode toggle button as nav link on mobile */
.m-dark-toggle {
    background: rgba(255, 255, 255, 0.10) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: rgba(255, 255, 255, 0.85) !important;
    cursor: pointer;
    width: 40px !important;
    height: 40px !important;
    min-height: unset !important;
    border-radius: 50% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--m-transition);
    font-family: inherit;
    box-shadow: none !important;
    padding: 0 !important;
}

.m-dark-toggle:hover {
    background: rgba(255, 255, 255, 0.20) !important;
    border-color: rgba(255, 255, 255, 0.30) !important;
}

.m-dark-toggle .material-icons {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.90) !important;
}

.dark-mode .m-dark-toggle {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}

.dark-mode .m-dark-toggle:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
}

@media (max-width: 768px) {
    .m-dark-toggle {
        width: 100%;
        height: auto;
        padding: 12px 16px;
        border-radius: var(--m-radius-sm);
        justify-content: flex-start;
        gap: 10px;
    }

    .m-dark-toggle::after {
        content: attr(data-label);
        font-size: 0.9rem;
        font-weight: 500;
    }
}

/* ── Skip to content (a11y) ── */
.m-skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    background: var(--m-primary);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--m-radius);
    font-weight: 600;
    z-index: 9999;
    text-decoration: none;
    transition: top 0.2s ease;
}

.m-skip-link:focus {
    top: 8px;
}

/* ── RTL Support (Arabic) ── */
html[dir="rtl"] {
    direction: rtl;
}

html[dir="rtl"] .m-nav-inner {
    flex-direction: row-reverse;
}

html[dir="rtl"] .m-nav-links {
    flex-direction: row-reverse;
}

html[dir="rtl"] .m-footer-top {
    direction: rtl;
}

html[dir="rtl"] .hero-inner {
    direction: rtl;
}

html[dir="rtl"] .hero-actions {
    flex-direction: row-reverse;
}

html[dir="rtl"] .step-card,
html[dir="rtl"] .feature-tile,
html[dir="rtl"] .about-block {
    text-align: right;
}

html[dir="rtl"] .about-block {
    flex-direction: row-reverse;
}

html[dir="rtl"] .pf-item {
    flex-direction: row-reverse;
    text-align: right;
}

html[dir="rtl"] .faq-item summary {
    text-align: right;
}

html[dir="rtl"] .m-footer-col {
    text-align: right;
}

html[dir="rtl"] .m-footer-social {
    justify-content: flex-end;
}

html[dir="rtl"] .comparison-table td:first-child,
html[dir="rtl"] .comparison-table th:first-child {
    text-align: right;
}