:root {
    --primary: #0066cc;
    --secondary: #4a4a4a;
    --accent: #ffcc00;
    --bg-dark: #0f172a;
    --glass: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-white: #f8fafc;
    --text-dim: #94a3b8;
}

[dir="rtl"] {
    font-family: 'Tajawal', 'Outfit', sans-serif;
    text-align: right;
}

[dir="rtl"] .search-icon {
    margin-left: 0;
    margin-right: 1rem;
}

[dir="rtl"] .lightbulb-btn {
    right: auto;
    left: 2rem;
}

[dir="rtl"] .chat-wrapper {
    left: auto;
    right: 2rem;
}

[dir="rtl"] .chat-window {
    left: auto;
    right: 0;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-soft);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    filter: blur(80px);
    border-radius: 50%;
    opacity: 0.15; /* Much softer for light mode */
    animation: move 20s infinite alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: #0066cc;
    top: -100px;
    right: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: #4f46e5;
    bottom: -150px;
    left: -150px;
    animation-delay: -5s;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: #0ea5e9;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-duration: 30s;
}

@keyframes move {
    0% { transform: translate(0, 0); }
    100% { transform: translate(100px, 50px); }
}

/* Top Navigation Bar */
.top-nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid #e2e8f0;
}

.nav-link {
    text-decoration: none;
    color: #64748b;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.6rem 1.5rem;
    border-radius: 30px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-link:hover {
    color: var(--primary);
    background: rgba(0, 102, 204, 0.05);
}

.nav-link.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 102, 204, 0.2);
}

header {
    padding: 2rem 1rem;
    text-align: center;
    position: relative;
}

.lang-switcher {
    position: absolute;
    top: 1rem;
    right: 2rem;
    display: flex;
    gap: 0.5rem;
    font-size: 0.9rem;
    align-items: center;
}

.lang-switcher button {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-weight: 600;
    transition: color 0.3s;
}

.lang-switcher button.active {
    color: var(--primary);
}

.lang-switcher span {
    color: rgba(0,0,0,0.1);
}

.logo-container {
    margin-bottom: 1rem;
}

#main-logo {
    max-width: 280px;
    height: auto;
    /* Remove shadow for cleaner look on white */
}

h1 {
    font-weight: 600;
    letter-spacing: 1px;
    font-size: 1.4rem;
    color: var(--text-dark);
    text-transform: none;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
}

/* Search Box */
.search-section {
    width: 100%;
    max-width: 600px;
    margin-bottom: 3rem;
}

.search-box {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 50px;
    padding: 0.5rem 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 10px 40px rgba(0, 102, 204, 0.1);
    transform: translateY(-2px);
}

.search-icon {
    color: var(--text-dim);
    margin-left: 1rem;
    font-size: 1.2rem;
}

#iqama-search {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-dark);
    padding: 1rem;
    font-size: 1.1rem;
    outline: none;
    font-family: inherit;
}

#search-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

#search-btn:hover {
    background: #0052a3;
    transform: scale(1.05);
}

/* Worker Results */
.results-container {
    width: 100%;
    max-width: 800px;
    animation: fadeIn 0.5s ease;
}

.worker-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 2.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    box-shadow: var(--card-shadow);
}

.info-group label {
    display: block;
    color: var(--text-dim);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.info-group p {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
}

.salary-highlight {
    color: #16a34a !important; /* Darker green for white bg */
    font-size: 1.4rem !important;
}

/* Admin Panel */
.admin-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.admin-card {
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: var(--text-dark);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 30px 60px rgba(0,0,0,0.1);
}

#close-admin {
    color: var(--text-dark);
}

.admin-form {
    background: var(--bg-soft);
}

.admin-form input {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: var(--text-dark);
}

.admin-form input:focus {
    border-color: var(--primary);
}

.primary-btn {
    grid-column: 1 / -1;
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.worker-list-admin {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 2rem;
}

.admin-worker-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 0.5rem;
    border-radius: 8px;
}

.delete-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
}

/* Footer & Lightbulb */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-dim);
    font-size: 0.9rem;
}

#admin-trigger {
    cursor: pointer;
    transition: color 0.3s;
}

#admin-trigger:hover {
    color: var(--primary);
}

.lightbulb-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 45px;
    height: 45px;
    background: var(--accent);
    color: #000;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    box-shadow: 0 10px 20px rgba(255, 204, 0, 0.3);
    text-decoration: none;
    transition: transform 0.3s, box-shadow 0.3s;
    animation: pulse 2s infinite;
}

.lightbulb-btn:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 15px 30px rgba(255, 204, 0, 0.5);
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 204, 0, 0.4); }
    70% { box-shadow: 0 0 0 20px rgba(255, 204, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 204, 0, 0); }
}

/* Chatbot Styles */
.chat-wrapper {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    z-index: 9999; /* HIGHEST Z-INDEX */
}

.chat-bubble {
    width: 50px;
    height: 50px;
    background: black;
    color: white;
    border-radius: 50%;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 102, 204, 0.3);
    transition: transform 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10000 !important;
}

.chat-bubble:hover {
    transform: scale(1.1);
}

.chat-window {
    position: absolute;
    bottom: 70px;
    left: 0;
    width: 400px;
    height: 600px;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    animation: slideUp 0.3s ease;
}

.chat-header {
    background: var(--primary);
    padding: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

#close-chat {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
}

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #f8fafc;
}

.msg {
    padding: 0.8rem 1.2rem;
    border-radius: 15px;
    max-width: 85%;
    font-size: 0.95rem;
    line-height: 1.4;
}

.msg.bot {
    background: #ffffff;
    color: var(--text-dark);
    align-self: flex-start;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 2px;
}

.msg.user {
    background: var(--primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.chat-input-area {
    padding: 1rem;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 0.5rem;
}

.chat-input-area input {
    flex: 1;
    background: var(--bg-soft);
    border: 1px solid #e2e8f0;
    color: var(--text-dark);
    padding: 0.7rem 1rem;
    border-radius: 25px;
    outline: none;
}

#send-chat {
    background: var(--primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
}

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

.hidden {
    display: none !important;
}

/* CV Generator Styles */
.cv-preview-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 2000;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
}

.cv-a4 {
    width: 210mm;
    min-height: 297mm;
    background: white;
    padding: 20mm;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
    color: #333;
    font-family: 'Inter', sans-serif;
    position: relative;
}

.cv-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

.cv-logo img {
    height: 60px;
}

.cv-photo-box {
    width: 120px;
    height: 150px;
    border: 1px solid #eee;
    background: #fcfcfc;
    overflow: hidden;
}

.cv-photo-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cv-body {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

.cv-section-title {
    color: var(--primary);
    text-transform: uppercase;
    font-weight: 700;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.cv-field {
    margin-bottom: 1rem;
}

.cv-field label {
    font-size: 0.7rem;
    color: #888;
    display: block;
    text-transform: uppercase;
}

.cv-field p {
    font-weight: 600;
    font-size: 1rem;
}

.cv-ai-content {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #444;
    white-space: pre-line;
}

.cv-actions {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    padding-bottom: 3rem;
}

.cv-form textarea {
    width: 100%;
    height: 150px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 1rem;
    border-radius: 12px;
    font-family: inherit;
    margin-top: 0.5rem;
}

.gen-cv-btn {
    margin-top: 1.5rem;
    width: 100%;
    background: #10b981;
    color: white;
    border: none;
    padding: 0.8rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.3s;
}

.gen-cv-btn:hover {
    background: #059669;
}

@media print {
    .cv-preview-container {
        position: static;
        background: white;
        padding: 0;
    }
    .cv-actions {
        display: none;
    }
}

@media (max-width: 600px) {
    .worker-card {
        grid-template-columns: 1fr;
    }
    
    .search-box {
        flex-direction: column;
        border-radius: 20px;
        padding: 1rem;
    }
    
    #search-btn {
        width: 100%;
        margin-top: 1rem;
    }

    .chat-wrapper {
        left: 1rem;
        bottom: 1rem;
    }

    [dir="rtl"] .chat-wrapper {
        right: 1rem;
        left: auto;
    }

    .chat-bubble {
        width: 45px;
        height: 45px;
    }

    .chat-window {
        width: calc(100vw - 2rem);
        height: 70vh;
        bottom: 60px;
    }
}
