@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;700&family=Inter:wght@300;400;600;700&family=MedievalSharp&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;700&family=Reem+Kufi:wght@400;700&display=swap');

/* Font Definitions */
@font-face {
    font-family: 'Digi Maryam';
    src: local('Digi Maryam'), url('assets/Digi-Maryam-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* GE SS Two Light - Placeholder (File Missing in Assets) */
@font-face {
    font-family: 'GE SS Two Light';
    src: local('GE SS Two Light');
    /* Will rely on local install if missing from assets */
    font-weight: 300;
    font-style: normal;
}

:root {
    --primary-color: #6d4944;
    /* Updated Main Color */
    --text-color: #6d4944;
    /* Updated to match main color everywhere */
    --bg-color: #f7f3e8;
    /* Cream/Beige Background */
    --border-radius: 8px;
    /* Slight radius, not pill */
    --transition-speed: 0.3s;
}

/* Layer 0: Whole Page Background */
/* Layer 0: Whole Page Background */
body {
    font-family: 'GE SS Two Light', 'Cairo', sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    min-height: 100vh;
    color: var(--text-color);
    background-color: var(--bg-color);
    background-image: url('assets/bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    /* Flex column to push footer to bottom */
    flex-direction: column;
}

/* --- English Support (Optimized) --- */
body.lang-en {
    font-family: 'Inter', sans-serif !important;
}

body.lang-en .header-main,
body.lang-en .header-sub,
body.lang-en .section-title,
body.lang-en .body-text,
body.lang-en .copyright-text,
body.lang-en .btn-choose,
body.lang-en .btn-submit-form,
body.lang-en .custom-input,
body.lang-en .tc-text {
    font-family: 'Inter', sans-serif !important;
}

/* Maintain LTR text flow for English elements while keeping RTL overall structure */
body.lang-en .text-content {
    text-align: center !important;
}

body.lang-en .header-main {
    font-size: 1.7rem;
    /* Scaled to match visual weight of AR */
    margin-bottom: 1.45rem !important;
    font-weight: 600;
    text-align: center !important;
    font-family: 'MedievalSharp', cursive !important;
}

body.lang-en .header-sub {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center !important;
    margin-bottom: 1.95rem;
    font-family: 'MedievalSharp', cursive !important;
}

body.lang-en .body-text {
    text-align: left !important;
    line-height: 1.6;
    font-size: 0.95rem;
}

body.lang-en .upload-section {
    text-align: center !important;
}

body.lang-en .section-title {
    font-size: 1.2rem !important;
    /* Significantly smaller as requested */
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: left !important;
}

body.lang-en .user-details-form {
    text-align: left !important;
}

body.lang-en .custom-input {
    text-align: left !important;
}

body.lang-en .form-check {
    direction: ltr !important;
    justify-content: flex-start !important;
}

body.lang-en .form-check-input {
    order: -1;
    margin-right: 12px !important;
    margin-left: 0 !important;
}

body.lang-en .tc-text {
    text-align: left !important;
}

body.lang-en .header-controls {
    right: 1.5rem !important;
    left: auto !important;
}

/* ------------------------ */

/* Header Controls */
.header-controls {
    z-index: 1000;
}

.lang-switcher {
    background: #ffffff;
    padding: 4px;
    border-radius: 50px;
    display: flex;
    gap: 2px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(109, 73, 68, 0.1);
}

.lang-btn {
    border: none;
    background: none;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-btn.active {
    background-color: var(--primary-color);
    color: #fff;
}

.lang-btn:hover:not(.active) {
    background-color: rgba(109, 73, 68, 0.05);
}

.menu-icon {
    z-index: 100;
}

/* Main Container Higher Z-Index */
.MainContainer {
    position: relative;
    z-index: 20;
    /* Higher than footer/skyline so content sits on top */
    flex: 1;
    /* Takes up remaining space */
    display: flex;
    flex-direction: column;
}

.row.h-100 {
    margin: 0;
    flex: 1;
    /* Grow to fill container */
    padding-top: 5vh;
}

/* New Footer Styles */
.site-footer {
    position: relative;
    width: 100%;
    height: 6vh;
    /* Much thinner */
    background-color: var(--primary-color);
    /* Solid brown */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    /* Lower than MainContainer content */
}

/* Skyline Texture Layer */
.skyline-bg {
    position: absolute;
    bottom: 100%;
    /* Sits exactly on top edge of the footer */
    left: 0;
    width: 100%;
    height: 35vh;
    /* Height of the skyline texture */
    background: url('assets/bg-bottom.png') no-repeat center bottom;
    background-size: 100% auto;
    /* Full width, auto height */
    z-index: -2;
    /* Place behind the footer content if needed, but mainly z-1 on page */
    pointer-events: none;
}

.copyright-text {
    position: relative;
    z-index: 2;
    font-family: 'GE SS Two Light', sans-serif;
    font-weight: 300;
    font-size: 0.8rem;
    color: #fff;
    /* White text */
    text-align: center;
    width: 100%;
}

/* Left Image Side */
.image-side {
    position: relative;
    min-height: 50vh;
    display: flex;
    align-items: flex-end;
    /* Bottom align */
    justify-content: center;
}

.image-side::after {
    content: '';
    position: absolute;
    bottom: 0;
    /* Align flush to bottom */
    left: 0;
    width: 100%;
    height: 95%;
    /* Increased scale as requested */
    background: url('assets/left.png') no-repeat center bottom;
    background-size: contain;
    z-index: 2;
}

/* Right Content Side */
.content-side {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 2rem 4rem;
    padding-top: 5vh;
    position: relative;
}

/* Typography - Sizes Increased */
.text-content {
    margin-bottom: 2rem;
    max-width: 550px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.header-main {
    font-family: 'Digi Maryam', 'Reem Kufi', serif;
    font-weight: normal;
    font-size: 4rem;
    /* Increased to 3.5rem */
    color: var(--primary-color);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    line-height: 0.35;
}

.header-sub {
    font-family: 'Digi Maryam', 'Reem Kufi', serif;
    font-size: 3.5rem;
    /* Matched header-main size */
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-weight: normal;
}

.body-text {
    font-family: 'GE SS Two Light', 'Cairo', sans-serif;
    font-size: 1rem;
    line-height: 2;
    color: var(--text-color);
    text-align: justify;
    font-weight: 300;
}

/* Upload Section */
.upload-section {
    width: 100%;
    max-width: 550px;
    margin: 0 auto;

}

.section-title {
    font-family: 'Digi Maryam', 'Reem Kufi', serif;
    color: var(--primary-color);
    font-size: 2.75rem;
    font-weight: normal;
    margin-bottom: 1rem;
}

.upload-area {
    background: #ffffff;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Upload Zone - Fixed Height */
.custom-file-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    border: 2px dashed #eee;
    padding: 0;
    border-radius: var(--border-radius);
    transition: border 0.3s;
    height: 250px;
    /* Increased slightly for better view */
    background-color: #fff;
    overflow: hidden;
    /* Hide overflow from container */
}

.upload-ui-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    width: 100%;
    /* Keep it visible always, but it scrolls with content or stays top? 
       Let's keep it as part of the flow. */
}


.custom-file-upload:hover {
    border-color: var(--primary-color);
}

.upload-icon {
    font-size: 3rem;
    /* Larger icon */
    color: #e0d8d0;
    /* Much lighter, subtle color */
    margin-top: 0;
    transition: color 0.3s;
}

.custom-file-upload:hover .upload-icon {
    color: var(--primary-color);
}

/* Gallery Grid Styles */
.upload-body {
    overflow-y: auto;
    padding: 40px 24px;
    /* Significant top/bottom buffer to prevent touching borders */
    cursor: pointer;
}


.gallery-grid {
    display: grid;
    /* Force 5 items per row as requested */
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    /* Increased gap for less busy look */
    width: 100%;
}

.gallery-item {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    /* Square thumbnails */
    border-radius: 6px;
    /* Slightly smaller radius for compactness */
    overflow: hidden;
    background-color: #f7f3e8;
    border: 1px solid #eee;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-btn-overlay {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.remove-btn-overlay:hover {
    background-color: #dc3545;
    color: white;
}

.remove-btn-overlay i {
    font-size: 1rem;
    line-height: 1;
}

.btn-choose {
    background-color: var(--primary-color);
    color: #fff;
    padding: 0.6rem 1.8rem;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-family: 'GE SS Two Light', 'Cairo', sans-serif !important;
    font-weight: 300;
    transition: 0.3s;
}

.btn-choose:hover {
    background-color: #573a36;
}

#fileElem {
    display: none;
}

/* Alert Messages (Floating Toasts) */
.alert-message {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: auto;
    min-width: 320px;
    max-width: 90%;
    padding: 15px 25px;
    border-radius: 50px;
    /* Pill shape for premium feel */
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
    animation: slideDownToast 0.5s ease forwards;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

@keyframes slideDownToast {
    from {
        opacity: 0;
        transform: translate(-50%, -100%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.alert-success {
    background: #198754;
    /* Bootstrap Success Green for clarity, or keep Gold? User liked Gold. Let's keep Gold trend but solid. */
    background: linear-gradient(135deg, #d0ae81 0%, #b89a6f 100%);
    color: #fff;
    border: none;
}

.alert-success i {
    color: #fff;
    font-size: 1.5rem;
    margin-left: 8px;
}

.alert-error {
    background: #dc3545;
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    color: #fff;
    border: none;
}

.alert-error i {
    color: #fff;
    font-size: 1.5rem;
    margin-left: 8px;
}

@media (max-width: 768px) {
    .alert-message {
        padding: 12px 20px;
        font-size: 0.9rem;
        width: 90%;
    }
}


.btn-submit-form {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    padding: 0.8rem 3.5rem;
    border-radius: var(--border-radius);
    font-size: 1.3rem;
    font-family: 'GE SS Two Light', 'Cairo', sans-serif !important;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 4px 8px rgba(61, 43, 31, 0.2);
}

.btn-submit-form:hover {
    background-color: #573a36;
    transform: translateY(-2px);
}

/* Form Inputs Styling */
.user-details-form {
    width: 100%;
    max-width: 100%;
}


.custom-input {
    background-color: #f9f9f9;
    /* Subtle grey to stand out on white */
    border: 1px solid #e0e0e0;
    border-radius: var(--border-radius);
    padding: 0.8rem 1rem;
    font-family: 'Cairo', sans-serif;
    color: var(--text-color);
    transition: all 0.3s ease;
    text-align: right;
    /* RTL */
    font-size: 0.95rem;
}

.custom-input::placeholder {
    color: #b0a499;
    font-size: 0.9rem;
}

.custom-input:focus {
    background-color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(109, 73, 68, 0.1);
    outline: none;
}

/* Custom Checkbox Styling to match theme */
.form-check-input {
    width: 1.25em;
    height: 1.25em;
    border: 2px solid #d0ae81;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(109, 73, 68, 0.25);
    border-color: var(--primary-color);
}

.tc-link {
    color: var(--primary-color);
    text-decoration: underline;
    transition: color 0.2s;
}

.tc-link:hover {
    color: #573a36;
}

/* Responsive adjustments */
@media (max-width: 991px) {
    .row.h-100 {
        padding-top: 0;
    }

    .image-side {
        height: 45vh;
        min-height: 350px;
        align-items: flex-end;
    }

    .image-side::after {
        background-position: center bottom;
        height: 90%;
        bottom: 0;
    }

    .content-side {
        padding: 2rem;
        background: rgba(247, 243, 232, 0.95);
        padding-top: 2rem;
    }

    .header-main,
    .header-sub {
        font-size: 2.5rem;
        /* Adjusted for mobile */
    }

    .site-footer {
        height: auto;
        padding: 1rem 0;
    }

    .footer-overlay {
        display: none;
        /* Hide texture on mobile footer if it makes text hard to read or keep it */
        /* keeping it for now */
        display: block;
    }
}