:root {
    --primary: #D95D04;
    --on-primary: #201A17;
    --primary-container: #FFDBC7;
    --on-primary-container: #331200;
    --secondary: #765848;
    --surface: #FFF8F5;
    --on-surface: #201A17;
    --surface-variant: #F4E0D6;
    --on-surface-variant: #53433B;
    --outline: #85736B;
    --shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.3);
    --success: #E69100;
}

[data-theme="dark"] {
    --primary: #FFB68E;
    --on-primary: #201A17;
    --primary-container: #7A3100;
    --on-primary-container: #FFDBC7;
    --secondary: #E6BEAC;
    --surface: #1A120E;
    --on-surface: #F0E0D9;
    --surface-variant: #53433B;
    --on-surface-variant: #D8C2B8;
    --outline: #A08D84;
    background-color: #1A120E;
}

html,
body {
    overflow-x: hidden;
    width: 100%;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--surface);
    color: var(--on-surface);
    transition: background-color 0.3s ease, color 0.3s ease;
    position: relative;
    /* Ensure absolute children are contained */
}

body.menu-open {
    overflow: hidden;
}

.lang-en {
    font-family: 'Outfit', sans-serif;
}

.lang-ar {
    font-family: 'Cairo', sans-serif;
}

.m3-card {
    background-color: var(--surface);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.m3-button-filled {
    background-color: var(--primary);
    color: var(--on-primary);
    padding: 12px 28px;
    border-radius: 100px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.m3-button-filled:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.nav-link {
    position: relative;
    padding: 8px 16px;
    transition: color 0.2s;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background-color: var(--primary);
    border-radius: 3px;
}

/* Animated Burger Icon */
.burger-container {
    width: 30px;
    height: 20px;
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.burger-line {
    width: 100%;
    height: 2.5px;
    background-color: var(--on-surface);
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.68, -0.6, 0.32, 1.6);
}

.burger-open .burger-line:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.burger-open .burger-line:nth-child(2) {
    opacity: 0;
    transform: translateX(20px);
}

.burger-open .burger-line:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Smart Drawer */
#nav-menu-mobile {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    /* 
       RTL (flex-end = Left): Drawer on Left
       LTR (flex-end = Right): Drawer on Right
       This matches standard mobile patterns where toggle is usually on the 'end' side.
    */
    justify-content: flex-end;
}

#nav-menu-mobile.open {
    opacity: 1;
    pointer-events: auto;
}

.drawer-content {
    width: 80%;
    max-width: 300px;
    height: 100%;
    background-color: var(--surface);
    padding: 20px 24px 24px 24px;
    /* Reduced top padding */

    display: flex;
    flex-direction: column;
    gap: 12px;
    /* Reduced gap */

    /* Fix for small screens */
    overflow-y: auto;

    /* Default Transition */
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* 
       Transform Logic:
       We want the drawer to be off-screen towards the edge it is aligned to.
       
       RTL (Drawer is on Left):
       - Hidden: translateX(-100%) -> Moves further Left (off-screen)
       - Open: translateX(0)
       
       LTR (Drawer is on Right):
       - Hidden: translateX(100%) -> Moves further Right (off-screen)
       - Open: translateX(0)
    */
}

/* Default (likely RTL based on file history, but let's be explicit if possible or assume base) */
/* Assuming base allows for standard override, but let's target via dir/default */

/* RTL Handling */
[dir="rtl"] .drawer-content {
    transform: translateX(-100%);
    /* Hidden to Left */
}

[dir="rtl"] #nav-menu-mobile.open .drawer-content {
    transform: translateX(0);
}

/* LTR Handling */
[dir="ltr"] .drawer-content {
    transform: translateX(100%);
    /* Hidden to Right */
}

[dir="ltr"] #nav-menu-mobile.open .drawer-content {
    transform: translateX(0);
}

/* Base fallback if dir attribute is missing (assumes LTR usually, or RTL if that's primary) */
/* Since site defaults to AR, we can map base to RTL behavior if needed, 
   but the specific selectors above are safer. */
:root:not([dir]) .drawer-content {
    transform: translateX(-100%);
}

:root:not([dir]) #nav-menu-mobile.open .drawer-content {
    transform: translateX(0);
}

.gradient-mesh {
    background: radial-gradient(at 0% 0%, rgba(252, 103, 4, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(252, 103, 4, 0.08) 0px, transparent 50%);
}

/* Form Styles */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 0.75rem;
    font-weight: 700;
    opacity: 0.7;
    padding: 0 4px;
    margin-bottom: 0;
    display: block;
    transition: color 0.2s, opacity 0.2s;
}

.form-input {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.05);
    /* Default for dark mode */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    color: var(--on-surface);
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
}

[data-theme="light"] .form-input {
    background-color: #ffffff;
    border-color: rgba(217, 93, 4, 0.15);
    /* Subtle primary border */
}

.form-input:focus {
    border-color: var(--primary);
    background-color: var(--surface);
    box-shadow: 0 0 0 4px rgba(217, 93, 4, 0.1);
}

.form-group:focus-within .form-label {
    color: var(--primary);
    opacity: 1;
}