/* General Resets & Base Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-color: #9b59b6; /* Purple */
    --secondary-color: #6c5ce7; /* Darker Purple/Blue */
    --accent-color: #0be881; /* Greenish accent for highlights */
    --text-light: rgba(255, 255, 255, 0.9);
    --text-dark: rgba(0, 0, 0, 0.8);
    --bg-dark: rgba(0, 0, 0, 0.9); /* Used for solid dark backgrounds like header in forms */
    --card-bg-light: rgba(255, 255, 255, 0.08); /* Adjusted for glassmorphism */
    --card-border: rgba(255, 255, 255, 0.18); /* Adjusted for glassmorphism */
    --shadow-light: 0 5px 15px rgba(0, 0, 0, 0.2);
    --shadow-dark: 0 10px 30px rgba(0, 0, 0, 0.4);
    --gradient-purple: linear-gradient(135deg, var(--primary-color), var(--secondary-color));

    /* Specific colors for status buttons */
    --status-scheduled-color: #ff8c00; /* Orange */
    --status-completed-color: var(--accent-color); /* Green */
    --status-postponed-color: #ffc107; /* Yellow */
    --status-confirmed-color: #17a2b8; /* Turquoise */
    --status-in-progress-color: var(--primary-color); /* Purple (default) */
    --status-edit-color: #6f42c1; /* Darker Purple for Edit */
}

/* Ensure font path is correct for Montserrat-Arabic if you are using it locally */
@font-face {
    font-family: 'Montserrat-Arabic';
    src: url('font/Montserrat-Arabic-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}
/* Fallback for Cairo if Montserrat-Arabic isn't available */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');


body {
    font-family: 'Cairo', 'Montserrat-Arabic', sans-serif; /* Prioritize Cairo for Arabic */
    background-color: #1a1a2e; /* Dark background */
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    background-image: url('img/background-pattern.png'); /* A subtle, modern pattern - Make sure path is correct */
    background-size: cover;
    background-attachment: fixed;
    position: relative;
    display: flex; /* Use flexbox for centering content */
    flex-direction: column;
    align-items: center; /* Center horizontally */
    /* Removed justify-content: center; to allow content to flow from top */
    padding: 20px; /* Add some padding around the content */
    direction: rtl; /* Apply RTL universally for Arabic content */
    text-align: right; /* Ensure text alignment is right */
}

/* Background Animated Blobs for dynamic feel */
.background-blob {
    position: fixed; /* Changed to fixed for better responsiveness */
    border-radius: 50%;
    opacity: 0.3;
    filter: blur(100px); /* Soft blur effect */
    z-index: -1;
    animation: blob-animate 15s infinite alternate;
}

.background-blob.top-left {
    width: 300px;
    height: 300px;
    background-color: var(--primary-color);
    top: -50px;
    right: -50px; /* Adjusted for RTL: top-right */
    left: auto;
    animation-delay: 0s;
}

.background-blob.bottom-right {
    width: 400px;
    height: 400px;
    background-color: var(--secondary-color);
    bottom: -100px;
    left: -100px; /* Adjusted for RTL: bottom-left */
    right: auto;
    animation-delay: 2s;
}

@keyframes blob-animate {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -50px) scale(1.1); }
    66% { transform: translate(-20px, 40px) scale(0.9); }
    100% { transform: translate(0, 0) scale(1); }
}

/* --- Global Animations --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in-up { animation: fadeInUp 0.8s ease-out forwards; opacity: 0; }
.is-visible { opacity: 1; transform: translate(0, 0); }


/* --- Glassmorphism Effect --- */
.glassmorphism {
    background: rgba(255, 255, 255, 0.08); /* Slightly visible background */
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(8px); /* The key to glass effect */
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    transition: all 0.3s ease-in-out;
}

.glassmorphism:hover {
    background: rgba(255, 255, 255, 0.15); /* Slightly brighter on hover */
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
}


/* --- Header Styles (Applicable to job.php, admin_panel.php, index.php, login.php etc.) --- */
header {
    width: 100%;
    max-width: 1000px; /* Increased max-width for better use of space */
    padding: 20px 30px;
    margin-bottom: 30px; /* Space below header */
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping for responsiveness */
    box-shadow: var(--shadow-dark);
    text-align: right; /* Default for RTL */
}

/* Specific header adjustments for form pages (index.php, login.php) */
body.form-page header { /* Added a class to body for specific header styling */
    flex-direction: column; /* Stack items vertically */
    justify-content: center;
    align-items: center;
    max-width: 800px; /* Keep header width aligned with form */
    margin-bottom: 10px;
    padding: 15px 10px;
    gap: 1px;
}

body.form-page header img {
    width: 120px; /* Adjust logo size */
    height: auto;
    filter: drop-shadow(0 0 8px var(--primary-color)); /* Glow effect for the logo */
    margin-bottom: -35px; /* Add some space below the logo */
}

header h1 {
    font-size: 2.2rem;
    color: var(--text-light);
    font-weight: 700;
    text-shadow: 0 0 8px var(--primary-color);
    margin: 0; /* Reset margins from general h1 */
}

/* Search Container in Header (job.php, admin_panel.php) */
.search-container {
    flex-grow: 1;
    margin: 10px 0;
    min-width: 200px;
    padding-left: 20px; /* Space for RTL */
}

#employeeSearch {
    width: 100%;
    padding: 12px 20px;
    border-radius: 25px;
    border: 1px solid var(--card-border);
    background-color: rgba(255, 255, 255, 0.15);
    color: var(--text-light);
    font-size: 1em;
    outline: none;
    transition: all 0.3s ease;
    text-align: right; /* Ensure search input text aligns right */
}

#employeeSearch::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

#employeeSearch:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.3);
    background-color: rgba(255, 255, 255, 0.25);
}

/* Filter/Action Buttons Container (job.php, admin_panel.php, index.php) */
.filter-buttons-container {
    width: 100%;
    max-width: 1000px; /* Increased max-width */
    padding: 15px 20px;
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.filter-btn, .add-form-btn, .btn {
    background: var(--gradient-purple);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    white-space: nowrap; /* Prevent text wrapping */
    text-decoration: none; /* For anchor buttons */
    display: inline-flex; /* Align text and allow padding */
    align-items: center;
    justify-content: center;
}

.filter-btn:hover, .add-form-btn:hover, .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3), 0 0 10px var(--primary-color);
}

.filter-btn.active {
    background: var(--accent-color); /* Greenish accent for active filter */
    box-shadow: 0 0 0 3px rgba(11, 232, 129, 0.5); /* Matching accent color shadow */
}

/* Logout button specific style */
header .filter-btn[type="submit"], .btn-danger {
    background-color: #dc3545; /* Red */
    background-image: none; /* Override gradient */
}
header .filter-btn[type="submit"]:hover, .btn-danger:hover {
    background-color: #c82333; /* Darker red */
}


/* --- Card Holder & Card Styles (job.php, admin_panel.php) --- */
.sec1 {
    width: 100%;
    max-width: 1200px; /* Increased overall section width */
    margin-bottom: 50px; /* Space at the bottom */
}

.card-holder {
    display: grid;
    /* Changed minmax to allow cards to be wider */
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); /* Cards are now wider */
    gap: 25px;
    padding: 0;
    justify-content: center; /* Center cards if they don't fill the row */
}

.card {
    background: var(--card-bg-light);
    border-radius: 16px;
    box-shadow: var(--shadow-dark);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--card-border);
    padding: 25px;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    min-height: 280px; /* Increased min-height to accommodate more data */
    overflow: hidden; /* Ensure content doesn't spill */
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45);
}

.card h2, .card p {
    margin-bottom: 8px; /* Slightly less space to pack more info */
    color: var(--text-light);
    word-wrap: break-word; /* Ensure long words break */
    hyphens: auto; /* Allow hyphenation */
}

.card h2 {
    font-size: 1.5em;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding-bottom: 8px;
    margin-bottom: 15px;
    color: var(--primary-color); /* Highlight card title */
    font-weight: 700;
}

.card p {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.8);
}
.card p strong {
    color: var(--accent-color); /* Highlight strong text */
}


/* Details Section within Cards (for both job.php and admin_panel.php) */
.details-section {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
    color: var(--text-light);
    word-wrap: break-word; 
}
.details-section h3 {
    margin-top: 0;
    color: var(--primary-color); /* Use primary color for sub-headings */
    font-size: 1em;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 5px;
    margin-bottom: 8px;
}
.details-section p {
    margin-bottom: 5px;
    line-height: 1.4;
    font-size: 0.9em;
}
.details-section p strong {
    color: var(--accent-color);
}
.details-section a {
    color: var(--accent-color);
    text-decoration: none;
    word-break: break-all; /* Ensure long URLs break */
}
.details-section a:hover {
    text-decoration: underline;
}


/* Status Buttons within Cards */
.status-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto; /* Pushes buttons to the bottom */
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    justify-content: center; /* Center buttons horizontally */
}

.status-btn {
    flex-grow: 1; /* Allow buttons to grow */
    max-width: 150px; /* Limit individual button width */
    text-align: center;
    padding: 8px 12px; /* Slightly smaller padding for more buttons */
    border-radius: 20px;
    text-decoration: none;
    color: white;
    font-size: 0.85em; /* Slightly smaller font size */
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    white-space: nowrap;
    border: 1px solid transparent;
}

/* Specific button styles based on data-status */
.status-btn[data-status="appointment_scheduled"] { background-color: var(--status-scheduled-color); border-color: var(--status-scheduled-color); }
.status-btn[data-status="appointment_scheduled"]:hover { background-color: #cc6d00; }

.status-btn[data-status="appointment_completed"] { background-color: var(--status-completed-color); border-color: var(--status-completed-color); }
.status-btn[data-status="appointment_completed"]:hover { background-color: #08bb6b; }

.status-btn[data-status="appointment_postponed"] { background-color: var(--status-postponed-color); border-color: var(--status-postponed-color); }
.status-btn[data-status="appointment_postponed"]:hover { background-color: #e0a800; }

.status-btn[data-status="confirmed"] { background-color: var(--status-confirmed-color); border-color: var(--status-confirmed-color); }
.status-btn[data-status="confirmed"]:hover { background-color: #138496; }

.status-btn[data-status="in_progress"] { background-color: var(--status-in-progress-color); border-color: var(--status-in-progress-color); }
.status-btn[data-status="in_progress"]:hover { background-color: #7b4c8a; }

/* Active status indicator on the current status button */
.status-btn.active {
    background: rgba(255, 255, 255, 0.15); /* More subtle active state glass effect */
    color: var(--accent-color); /* Highlight text with accent */
    border: 2px solid var(--accent-color); /* Stronger border */
    font-weight: bold;
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(11, 232, 129, 0.5); /* Accent color shadow */
}

/* Edit Button for Admin Panel (if used) */
.status-btn.edit-btn {
    background-color: var(--status-edit-color); 
    border-color: var(--status-edit-color);
}
.status-btn.edit-btn:hover {
    background-color: #5a2e99;
}


/* Modal Styles (for image viewer - if applicable) */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.8); 
    align-items: center;
    justify-content: center;
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 80%;
    max-height: 80%;
    border-radius: 10px;
}

#caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    height: 150px;
}

.close-button {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}


/* --- Forms Styling (for index.php, schedule_appointment.php, complete_appointment.php, postpone_appointment.php, login.php) --- */
.form-container { /* This targets the .card in section1 but more generally */
    max-width: 500px; /* Limit form width */
    width: 90%; /* Responsive width */
    padding: 40px;
    margin: 20px 0; /* Add margin top/bottom */
    text-align: center;
    box-shadow: var(--shadow-dark);
    /* Apply glassmorphism here */
    background: var(--card-bg-light);
    border-radius: 16px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--card-border);
    transition: all 0.3s ease-in-out;

    /* New: Flexbox for stacking elements neatly */
    display: flex;
    flex-direction: column; /* Stack children vertically */
    align-items: center; /* Center items horizontally within the card */
}

/* Styles specifically for forms within a section1 container, like index.php */
.section1 .form-container {
    margin-bottom: 50px; /* Add margin at the bottom of the section */
}

.form-container h1 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 30px;
    font-weight: 700;
    text-shadow: 0 0 5px rgba(155, 89, 182, 0.5);
    width: 100%; /* Make h1 take full width to center it properly */
}

.form-group {
    margin-bottom: 20px;
    width: 100%; /* Ensure form group takes full width of its parent */
    text-align: right; /* For RTL labels */
}

.form-group label {
    display: block; /* Important: Makes the label take its own line */
    margin-bottom: 8px; /* Space between the label and the input directly below it */
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 600;
    text-align: right; /* Align text to the right for RTL */
    padding-right: 5px; /* Small internal padding for the label text */
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group input[type="url"],
.form-group input[type="password"],
.form-group textarea,
.form-group input[type="file"] { /* Added file input here for consistency */
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 0; /* Managed by form-group margin */
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.05); /* Slightly visible input background */
    color: var(--text-light);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    text-align: right; /* Default for Arabic */
    -webkit-appearance: none; 
    appearance: none; 
}

.form-group input[type="text"]::placeholder,
.form-group input[type="email"]::placeholder,
.form-group input[type="tel"]::placeholder,
.form-group input[type="date"]::placeholder,
.form-group input[type="url"]::placeholder,
.form-group input[type="password"]::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.3);
    background-color: rgba(255, 255, 255, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* Submit buttons within forms */
.form-container .btn {
    width: 100%; /* Make button full width within form container */
    max-width: 250px; /* Limit button width */
    margin-top: 20px;
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    /* Overrides default btn background if specific colors needed */
    background: var(--gradient-purple);
    color: white;
}

.form-container .btn-secondary { /* For "Back" buttons */
    background: var(--secondary-color);
    background-image: none; /* Override gradient */
}
.form-container .btn-secondary:hover {
    background-color: #5a6268;
}

/* Message Styles (for success/error messages in forms or at top of pages) */
.message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-size: 1em;
    text-align: center;
    color: var(--text-light);
    width: 100%; /* Ensure messages take full width */
    max-width: 800px; /* Limit message width */
}

.message.success {
    background-color: rgba(11, 232, 129, 0.2);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
}

.message.error {
    background-color: rgba(220, 53, 69, 0.2);
    border: 1px solid #dc3545; /* Using standard red for error */
    color: #dc3545;
}

/* Empty State Message */
#noInitialResults, #noFilterResults {
    color: var(--text-light);
    font-size: 1.2em;
    text-align: center;
    width: 100%;
    grid-column: 1 / -1; /* Span across all columns in grid */
    margin-top: 50px;
}


/* --- Media Queries for Responsiveness --- */
@media (max-width: 1024px) {
    .sec1, header, .filter-buttons-container {
        max-width: 95%; /* Adjust max-width for slightly smaller screens */
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start; /* Align search/buttons to start in column */
        padding: 15px 20px;
        margin-bottom: 20px;
    }
    header h1 {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }
    .search-container {
        margin-top: 15px;
        width: 100%;
        padding-left: 0; /* Remove left padding on smaller screens */
    }
    .filter-buttons-container {
        flex-direction: column;
        align-items: center;
        padding: 10px;
        margin-bottom: 20px;
    }
    .filter-btn, .add-form-btn {
        width: 90%;
        margin-bottom: 8px;
    }
    .card-holder {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Adjust card width slightly for tablets */
    }
    .card {
        padding: 20px;
        min-height: 250px; /* Adjust min-height */
    }
    .status-buttons {
        flex-direction: column; /* Stack buttons vertically on small screens */
        gap: 6px;
    }
    .status-btn {
        width: 100%;
        max-width: none; /* Allow to take full width */
        padding: 10px;
        font-size: 0.9em;
    }
    .form-container {
        padding: 25px;
        width: 95%;
    }
    .form-container h1 {
        font-size: 1.6rem;
        margin-bottom: 25px;
    }
    .form-group input, .form-group textarea {
        padding: 10px 12px;
        font-size: 0.95rem;
    }
    .form-group label {
        font-size: 0.95rem;
    }
    .form-container .btn {
        padding: 10px 20px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    header {
        padding: 10px 15px;
        margin-bottom: 15px;
    }
    header h1 {
        font-size: 1.5rem;
    }
    body.form-page header img {
        width: 80px; /* Even smaller logo on very small screens */
        margin-bottom: -20px;
    }
    .filter-buttons-container {
        padding: 5px;
        gap: 5px;
    }
    .filter-btn, .add-form-btn {
        width: 100%;
        font-size: 0.9em;
    }
    .card-holder {
        grid-template-columns: 1fr; /* Single column on very small screens */
    }
    .card {
        padding: 15px;
        min-height: 220px;
    }
    .card h2 {
        font-size: 1.3em;
    }
    .details-section h3 {
        font-size: 0.95em;
    }
    .details-section p, .card p {
        font-size: 0.85em;
    }
    .form-container {
        padding: 20px;
    }
    .form-container h1 {
        font-size: 1.4rem;
        margin-bottom: 20px;
    }
}