:root {
    /* Palette inspired by official Hajj portals (Yalamlam vibes) */
    --primary-blue: #004d7a;
    /* Deep Official Blue */
    --secondary-blue: #0068a3;
    /* Lighter Blue for hovers */
    --accent-gold: #c5a059;
    /* Beige/Gold for borders/accents */
    --success-green: #28a745;
    /* Success state */
    --bg-light: #f4f7f6;
    /* Page background */
    --white: #ffffff;
    --text-dark: #333333;
    --text-grey: #666666;
    --error-red: #dc3545;
    --shadow-soft: 0 10px 30px rgba(0, 77, 122, 0.08);
    --shadow-hover: 0 15px 35px rgba(0, 77, 122, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    /* Subtle Pattern Background */
    background-image: radial-gradient(#004d7a 0.5px, transparent 0.5px), radial-gradient(#004d7a 0.5px, var(--bg-light) 0.5px);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    animation: bgMove 60s linear infinite;
}

/* --- Header Section --- */
header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #002845 100%);
    color: var(--white);
    padding: 2rem 1rem;
    text-align: center;
    border-bottom: 5px solid var(--accent-gold);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 10;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.logo-info-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    width: 100%;
    flex-wrap: wrap;
}

.logo-img {
    width: 120px;
    height: auto;
    max-height: 120px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
    animation: float 6s ease-in-out infinite;
    flex-shrink: 0;
}

.ministry-info {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
    min-width: 300px;
}

.country-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--white);
    margin: 0;
    letter-spacing: -0.2px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ministry-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--white);
    margin: 0;
    letter-spacing: -0.3px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sector-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-gold);
    margin: 0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

h1 {
    font-size: 1.8rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.5px;
}

.page-titles {
    text-align: center;
    margin-bottom: 2rem;
    padding: 0 1rem;
    width: 100%;
    max-width: 650px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.page-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-blue);
    text-align: center;
    margin: 0.5rem 0 1.5rem 0;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    width: 100%;
}

p.subtitle {
    font-size: 1rem;
    color: var(--text-grey);
    font-weight: 500;
    margin: 0;
    text-align: center;
    width: 100%;
}

/* --- Main Content --- */
main {
    flex: 1;
    padding: 3rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
}

.search-card {
    background: var(--white);
    width: 100%;
    max-width: 650px;
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
    padding: 3rem;
    border-top: 1px solid rgba(255, 255, 255, 0.5);
    position: relative;
    overflow: hidden;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    animation: slideUpFade 1s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s backwards;
}

.search-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.search-card::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, var(--primary-blue), var(--accent-gold), var(--primary-blue));
    background-size: 200% 100%;
    animation: gradientFlow 3s linear infinite;
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 700;
    color: var(--primary-blue);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-wrapper {
    position: relative;
    display: flex;
    gap: 12px;
    background: #fff;
    padding: 5px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    border: 1px solid #eee;
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    box-shadow: 0 8px 20px rgba(0, 77, 122, 0.1);
    border-color: var(--secondary-blue);
    transform: scale(1.01);
}

input[type="text"] {
    flex: 1;
    padding: 16px 20px;
    border: none;
    background: transparent;
    font-family: 'Tajawal', sans-serif;
    font-size: 1.1rem;
    color: var(--text-dark);
    direction: ltr;
    /* Passport numbers often latin/numbers */
    text-align: right;
}

input[type="text"]::placeholder {
    text-align: right;
    color: #aaa;
    transition: color 0.3s;
}

input[type="text"]:focus::placeholder {
    color: #ccc;
}

button.search-btn {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    color: var(--white);
    border: none;
    padding: 0 32px;
    border-radius: 10px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 10px rgba(0, 77, 122, 0.3);
    position: relative;
    overflow: hidden;
}

button.search-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

button.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 77, 122, 0.4);
}

button.search-btn:hover::after {
    left: 100%;
}

button.search-btn:active {
    transform: translateY(0);
}

.hint {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 1.2rem;
    font-size: 0.9rem;
    color: var(--text-grey);
    background: rgba(197, 160, 89, 0.1);
    /* Gold tint */
    padding: 10px 15px;
    border-radius: 8px;
    border-right: 4px solid var(--accent-gold);
    animation: fadeIn 1s ease-out 0.5s backwards;
}

/* --- Modal (Popup) Styles --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 20, 40, 0.7);
    /* Darker blue tint */
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    animation: fadeInOverlay 0.3s ease-out;
    padding: 1rem;
}

.modal-content {
    background-color: white;
    padding: 3rem 2rem;
    border-radius: 24px;
    width: 100%;
    max-width: 480px;
    text-align: center;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    animation: modalPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

/* Decorative circle behind icon */
.modal-content::before {
    content: '';
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(0, 77, 122, 0.05) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 0;
}

.close-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    /* RTL layout */
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    z-index: 2;
}

.close-btn:hover {
    background: var(--error-red);
    color: white;
    transform: rotate(90deg);
}

.modal-icon {
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.modal-icon svg {
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    animation: iconPulse 2s infinite ease-in-out;
}

.modal-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--primary-blue);
    position: relative;
    z-index: 1;
}

.modal-body {
    position: relative;
    z-index: 1;
}

.data-row {
    background: #f8fbff;
    border: 1px solid #eef2f5;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    transition: transform 0.2s;
}

.data-row:hover {
    transform: translateX(-5px);
    border-color: #dbeeff;
}

.modal-body .label {
    color: var(--text-grey);
    font-size: 0.85rem;
    display: block;
    margin-bottom: 4px;
}

.modal-body .value {
    color: var(--text-dark);
    font-weight: 700;
    font-size: 1.1rem;
    display: block;
}

.modal-committee-badge {
    background: linear-gradient(135deg, var(--accent-gold) 0%, #b08d4b 100%);
    color: white;
    padding: 10px 24px;
    border-radius: 30px;
    display: inline-block;
    margin-top: 15px;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(197, 160, 89, 0.4);
    animation: badgeSlide 0.5s ease-out backwards 0.2s;
}

.modal-error {
    color: var(--error-red);
}

.btn-modal-close {
    margin-top: 2rem;
    padding: 12px 40px;
    background-color: #f0f2f5;
    color: var(--text-dark);
    border: none;
    border-radius: 10px;
    font-family: inherit;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.2s;
    position: relative;
    z-index: 1;
}

.btn-modal-close:hover {
    background-color: #e4e6e9;
    transform: translateY(-2px);
}

/* --- Loader --- */
.loader {
    display: none;
    text-align: center;
    margin-top: 30px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 77, 122, 0.1);
    border-top: 4px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    margin: 0 auto;
}

/* --- Footer --- */
footer {
    background-color: #e9ecef;
    text-align: center;
    padding: 2rem 1rem;
    font-size: 0.9rem;
    color: var(--text-grey);
    border-top: 1px solid #dcdcdc;
    margin-top: auto;
}

/* --- Animations Keyframes --- */
@keyframes bgMove {
    0% {
        background-position: 0 0, 10px 10px;
    }

    100% {
        background-position: 100px 100px, 110px 110px;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes gradientFlow {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInOverlay {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalPop {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes iconPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

@keyframes badgeSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* --- Responsive Design (Mobile & Tablet) --- */
        @media (max-width: 768px) {
            header {
                padding: 1.5rem 1rem;
            }

            .logo-info-row {
                flex-direction: column;
                gap: 1rem;
            }

            .logo-img {
                width: 90px;
                max-height: 90px;
            }

            .ministry-info {
                text-align: center;
                min-width: auto;
            }

            .country-name {
                font-size: 1rem;
            }

            .ministry-name {
                font-size: 1.2rem;
            }

            .sector-name {
                font-size: 0.95rem;
            }

            .page-titles {
                margin-bottom: 1.5rem;
            }

            .page-title {
                font-size: 1.5rem;
                margin: 0.5rem 0 1rem 0;
            }

            p.subtitle {
                font-size: 0.9rem;
            }

    .search-card {
        padding: 2rem 1.5rem;
        margin: 0 10px;
        max-width: 100%;
    }

    .input-wrapper {
        flex-direction: column;
        gap: 0;
        padding: 0;
        border: none;
        background: transparent;
        box-shadow: none;
    }

    input[type="text"] {
        width: 100%;
        background: #fff;
        border: 2px solid #e0e0e0;
        border-radius: 10px;
        margin-bottom: 12px;
        padding: 14px;
    }

    input[type="text"]:focus {
        border-color: var(--secondary-blue);
        box-shadow: 0 0 0 4px rgba(0, 104, 163, 0.1);
    }

    button.search-btn {
        width: 100%;
        justify-content: center;
        padding: 14px;
    }

    .modal-content {
        padding: 2rem 1.5rem;
        width: 95%;
    }
}

