/* --- Basic Reset & Body --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #fccb26; /* Light green background */
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align to top for longer forms */
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
    direction: ltr; /* Default LTR */
}

/* --- RTL Styles --- */
html[lang="ar"] body {
    direction: rtl;
    font-family: 'Tahoma', 'Arial', sans-serif; /* Example Arabic font */
}


#preloader {
    position: fixed; /* Stay in place */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #f8f9fa; /* Light background, adjust as needed (e.g., match body bg #e8f5e9) */
    z-index: 9999; /* Ensure it's on top */
    display: flex; /* Use flexbox for centering */
    justify-content: center;
    align-items: center;
    opacity: 1; /* Start visible */
    visibility: visible;
    transition: opacity 0.6s ease-out, visibility 0.6s ease-out; /* Smooth fade-out */
}


/* Style for the content wrapper inside the preloader */
.preloader-content {
    text-align: center;
}

/* Style for the logo */
.preloader-logo {
    max-width: 300px; /* Adjust max size as needed */
    height: auto;
    margin-bottom: 20px;
    /* Creative Animation: Subtle Pulse */
    animation: pulse 1.5s ease-in-out infinite alternate;
}

/* Keyframes for the pulsing animation */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.9;
    }
    100% {
        transform: scale(1.08);
        opacity: 1;
    }
}

/* Creative Element: Loading Dots */
.preloader-dots {
    display: flex;
    justify-content: center;
    align-items: center;
}

.preloader-dots span {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin: 0 4px;
    background-color: #4caf50; /* Use your theme's green color */
    border-radius: 50%;
    opacity: 0; /* Start hidden */
    animation: dot-fade-in 1.2s ease-in-out infinite;
}

/* Stagger the animation for the dots */
.preloader-dots span:nth-child(1) {
    animation-delay: 0s;
}
.preloader-dots span:nth-child(2) {
    animation-delay: 0.2s;
}
.preloader-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* Keyframes for the dot fade animation */
@keyframes dot-fade-in {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0;
    }
    40% {
         transform: scale(1);
        opacity: 1;
    }
}


/* Class to hide the preloader */
.preloader-hidden {
    opacity: 0;
    visibility: hidden;
}
/* --- Form Container --- */
.form-container {
    background-color: #f4f5f8;
    padding: 30px 40px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 650px;
    margin-top: 20px;
    position: relative; /* For language switcher positioning */
}

h1, h2 {
    text-align: center;
    color: #242e32; /* Darker green */
    margin-bottom: 20px;
}

h1 {
    margin-bottom: 30px;
    font-size: 1.8em;
}

h2 {
    font-size: 1.4em;
    margin-bottom: 25px;
    border-bottom: 1px solid #fccb26; /* Light green separator */
    padding-bottom: 10px;
}


/* --- Language Switcher --- */
.language-switcher {
    position: absolute;
    top: 15px;
    right: 15px; /* Adjusted for LTR */
    display: flex;
    gap: 5px;
}
html[lang="ar"] .language-switcher {
    right: auto;
    left: 15px;
}
.language-switcher button {
    padding: 5px 8px;
    font-size: 0.8em;
    background-color: #fccb26; /* Lighter green */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.language-switcher button:hover {
    background-color: #ffffff;
}
.language-switcher button:active {
    background-color: #ffffff;
}



/* --- Progress Bar --- */
.progress-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
    position: relative; /* For the line */
}

.progress-bar::before { /* The connecting line */
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 3px;
    background-color: #fccb26; /* Light green line */
    transform: translateY(-50%);
    z-index: 1;
}

.progress-bar .step {
    width: 30px;
    height: 30px;
    background-color: #fccb26; /* Light green inactive */
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #616161; /* Grey text */
    font-weight: bold;
    position: relative;
    z-index: 2; /* Above the line */
    border: 3px solid #fccb26;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.progress-bar .step.active {
    background-color: #242e32; /* Active green */
    border-color: #242e32;
    color: #ffffff;
}

.progress-bar .step.completed { /* Style for completed steps */
     background-color: #242e32;
     border-color: #242e32;
     color: #ffffff;
}
.progress-bar .step.completed::after { /* Optional: Checkmark */
    content: '\2713'; /* Checkmark symbol */
    font-size: 16px;
    position: absolute;
}
.progress-bar .step.completed span {
    display: none; /* Hide number when checkmark is shown */
}


/* --- Form Steps --- */
.form-step {
    display: none; /* Hide steps by default */
    animation: fadeIn 0.5s ease-in-out;
}

.form-step.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Form Groups & Inputs --- */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1em;
    background-color: #f9f9f9;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #242e32; /* Green focus */
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
    outline: none;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* --- File Input & Preview --- */
.form-group input[type="file"] {
    padding: 10px; /* Adjust padding */
    background-color: transparent;
    border: 1px dashed #ccc; /* Dashed border */
    cursor: pointer;
}

#image-preview-container {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.img-preview {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #eee;
}

/* --- Priority Colors --- */
select#priority option.priority-high { background-color: #ffebee; color: #c62828; } /* Light Red BG, Dark Red Text */
select#priority option.priority-normal { background-color: #fff3e0; color: #f57c00; } /* Light Orange BG, Dark Orange Text */
select#priority option.priority-low { background-color: #e8f5e9; color: #242e32; } /* Light Green BG, Dark Green Text */
/* Add styling to show selected priority color if desired */


/* --- Buttons --- */
.form-buttons {
    display: flex;
    justify-content: space-between; /* Space out Back and Next/Submit */
    margin-top: 30px;
}

.form-buttons button {
    padding: 12px 25px;
    border: none;
    border-radius: 25px; /* Rounded buttons */
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
}

.form-buttons button:active {
    transform: scale(0.98);
}

.prev-btn {
    background-color: #fccb26; /* Grey */
    color: #555;
}
.prev-btn:hover {
    background-color: #bdbdbd;
}

.next-btn, .submit-btn {
    background-color: #242e32; /* Green */
    color: white;
}
.next-btn:hover, .submit-btn:hover {
    background-color: #fccb26; /* Darker green */
}

/* If only one button (e.g., first step), center it */
.form-step:first-child .form-buttons {
    justify-content: flex-end; /* Align next to the right */
}
html[lang="ar"] .form-step:first-child .form-buttons {
    justify-content: flex-start; /* Align next to the left for RTL */
}

/* --- Review Section --- */
#review-content {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}
#review-content p {
    margin-bottom: 10px;
    border-bottom: 1px dotted #eee;
    padding-bottom: 10px;
}
#review-content p:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}
#review-content strong {
    color: #242e32;
    margin-right: 8px;
}
html[lang="ar"] #review-content strong {
    margin-right: 0;
    margin-left: 8px;
}


/* --- Messages --- */
#form-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    display: none; /* Hidden by default */
}
#form-message.success {
    background-color: #dff0d8; /* Light green */
    color: #3c763d; /* Dark green */
    border: 1px solid #d6e9c6;
}
#form-message.error {
    background-color: #f2dede; /* Light red */
    color: #a94442; /* Dark red */
    border: 1px solid #ebccd1;
}


/* --- Responsiveness --- */
@media (max-width: 600px) {
    .form-container {
        padding: 20px;
    }
    h1 { font-size: 1.5em; }
    h2 { font-size: 1.2em; }
    .progress-bar .step { width: 25px; height: 25px; font-size: 0.8em; }
    .language-switcher { position: static; justify-content: center; margin-bottom: 15px;}
    .form-buttons { flex-direction: column-reverse; gap: 10px; } /* Stack buttons on small screens */
    .form-buttons button { width: 100%; }
}


/* .select-wrapper { position: relative; } */

select {
    /* Reset native appearance (Crucial for custom arrow) */
    -webkit-appearance: none; /* Safari, Chrome */
    -moz-appearance: none;    /* Firefox */
    appearance: none;

    /* Ensure background color/padding/border match other inputs */
    background-color: #f9f9f9; /* Match your input style */
    border: 1px solid #ccc;
    border-radius: 8px; /* Match your input style */
    padding: 12px 40px 12px 15px; /* Adjust padding: Right padding makes space for arrow */
    font-size: 1em;
    width: 100%;
    line-height: 1.5; /* Adjust if needed */
    color: #333; /* Match input text color */
    cursor: pointer;

    /* Add Custom Arrow using background image (SVG recommended) */
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%234CAF50%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 15px center; /* Position arrow */
    background-size: 12px auto; /* Size of the arrow */

    /* Remove default arrow in Internet Explorer 10/11 */
    &::-ms-expand {
        display: none;
    }
}

/* Optional: Style when focused */
select:focus {
    border-color: #4caf50; /* Match your focus style */
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.3); /* Match your focus style */
    outline: none;
}

/* Optional: Style for disabled state */
select:disabled {
    background-color: #e9ecef;
    opacity: 0.7;
    cursor: not-allowed;
    background-image: none; /* Hide arrow when disabled */
}

/* Specific overrides for RTL if needed */
html[dir="rtl"] select {
    padding: 12px 15px 12px 40px; /* Reverse padding */
    background-position: left 15px center; /* Reverse arrow position */
}


input[type="date"] {
    /* Ensure consistent styling with other inputs */
    background-color: #f9f9f9;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 12px 15px; /* Adjust padding as needed */
    font-size: 1em;
    width: 100%;
    line-height: 1.5;
    color: #333;
    cursor: pointer; /* Indicate it's clickable */
    min-height: 48px; /* Ensure sufficient tap target height */

    /* Attempt to style the placeholder text (might have limited effect on iOS) */
    /* You might need to use JS to show a custom placeholder if needed */
    color-scheme: light; /* Can sometimes influence native picker theme */
}

/* Style the native controls minimally (often ignored on iOS date) */
input[type="date"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-calendar-picker-indicator {
    /* display: none; */ /* Hiding the picker indicator often breaks it on iOS! */
    /* -webkit-appearance: none; */ /* Avoid this */
    /* You CAN try subtle color changes, but often overridden */
     opacity: 0.6; /* Example: Make slightly transparent */
     margin-right: 5px;
}


/* Add focus style */
input[type="date"]:focus {
     border-color: #4caf50;
     box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
     outline: none;
}

/* Optional: Add a Calendar Icon (Requires HTML change) */
/* HTML change needed: Wrap the input */
/* <div class="date-input-wrapper">
       <input type="date" id="report_date" name="report_date" required>
       <span class="date-icon"></span>
   </div> */

/* CSS for the wrapper and icon */
.date-input-wrapper {
    position: relative;
    width: 100%;
}

.date-input-wrapper input[type="date"] {
   /* Adjust padding if icon is inside */
   padding-right: 40px; /* Make space for icon inside */
}


.date-input-wrapper .date-icon {
    position: absolute;
    top: 50%;
    right: 15px; /* Position inside padding */
    transform: translateY(-50%);
    width: 18px; /* Adjust size */
    height: 18px;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"%3E%3C!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--%3E%3Cpath fill="%234CAF50" d="M128 0c17.7 0 32 14.3 32 32V64H288V32c0-17.7 14.3-32 32-32s32 14.3 32 32V64h48c26.5 0 48 21.5 48 48v48H0V112C0 85.5 21.5 64 48 64H96V32c0-17.7 14.3-32 32-32zM0 192H448V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V192zm64 80v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V272c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16zm128 0v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V272c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16zm144-16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V272c0-8.8-7.2-16-16-16H336zM64 400v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V400c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16zm144-16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V400c0-8.8-7.2-16-16-16H208zm128 0v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V400c0-8.8-7.2-16-16-16H336c-8.8 0-16 7.2-16 16z"/%3E%3C/svg%3E'); /* Calendar Icon SVG */
    background-repeat: no-repeat;
    background-position: center center;
    background-size: contain;
    pointer-events: none; /* Icon shouldn't be clickable */
    opacity: 0.7;
}
/* Adjust icon position for RTL */
html[dir="rtl"] .date-input-wrapper .date-icon {
    right: auto;
    left: 15px;
}