:root {
    /* Color Palette - Premium & Clean */
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #64748b;
    --accent-color: #0ea5e9;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --error-color: #ef4444;
    --success-color: #10b981;

    /* Mapped Legacy Vars */
    --card-bg: var(--surface-color);
    --text-color: var(--text-main);
    --text-light: var(--text-muted);
    --danger: var(--error-color);
    --success: var(--success-color);
    --font-main: 'Cairo', 'Inter', system-ui, -apple-system, sans-serif;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow: var(--shadow-lg);

    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Removed Dark Mode to enforce lightweight theme */

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

body {
    font-family: var(--font-main);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: var(--transition);
}

/* Auth Container */
#auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--background-color);
    padding: 2rem;
}

/* Glassmorphism Card */
.glass-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
}

.login-box {
    background: var(--card-bg);
    /* Fallback */
    padding: 3rem;
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 440px;
    text-align: center;
    /* Extend glass styles if class not present in HTML */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.login-box img {
    max-width: 100px;
    margin-bottom: 1rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
    /* Ensure autocomplete dropdown is positioned relative to this */
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    color: var(--text-main);
    background-color: var(--surface-color);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    background: var(--primary-color);
    color: white;
}

.btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: var(--danger);
}

.btn-secondary {
    background: var(--secondary-color);
}

.btn-action {
    min-width: 100px;
    margin: 2px 0;
}

.actions-cell {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.text-center {
    text-align: center !important;
}

/* App Container */
#app-container {
    display: none;
    /* Hidden by default */
}

/* Header */
header {
    background: var(--surface-color);
    color: var(--primary-color);
    padding: 1rem 2rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: relative;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    min-height: 140px;
}

/* Centering the brand using absolute positioning to ensure true center */
/* Centering the brand using grid standard flow */
.header-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    white-space: normal;
    max-width: 50vw;
    /* Strict limit to ensure wrapping */
    text-align: center;
    grid-column: 2;
}

.company-branding {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 1.8rem;
    /* Kept size but ensure wrapping */
    font-weight: 800;
    text-transform: uppercase;
    color: var(--secondary-color);
    flex-wrap: wrap;
}

.company-branding img {
    height: 120px;
    width: auto;
}

.app-subtitle {
    font-size: 1.3rem;
    font-weight: 600;
    opacity: 0.8;
    margin-top: 0;
    letter-spacing: 0.5px;
}

.company-branding span {
    /* Ensure text alignment */
    line-height: 1.2;
    text-align: center;
    word-break: break-word;
}

/* Decrease English company name font size specifically */
html[lang="en"] .company-branding span {
    font-size: 1.45rem;
    letter-spacing: -0.2px;
}

/* Ensure controls stay visible and don't overlap if screen is small */
.header-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-self: end;
}

/* ... existing language toggle code ... */
/* I will skip replacing the middle chunk to avoid massive context unless necessary. 
   Actually, I should target specific blocks or use multiple chunks if the tool supports it.
   replace_file_content supports single contiguous block. I will do two calls if needed, 
   but let's look at where they are.
   .app-subtitle is near line 160.
   footer is near line 353.
   They are far apart. I should use multi_replace_file_content or two replace calls.
   I will use multi_replace_file_content.
*/



/* Language Toggle specific style */
#lang-toggle-app,
#lang-toggle-login {
    color: #ffffff;
    /* Pure white for contrast against dark blue */
    font-weight: bold;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

#lang-toggle-app:hover,
#lang-toggle-login:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #ffffff;
}

#lang-toggle-login {
    /* Login box might have light background, let's check. 
       Login box is .login-box (white bg). So login toggle needs to be dark or blue.
    */
    color: var(--primary-color);
    border-color: var(--primary-color);
}

#lang-toggle-login:hover {
    background: var(--primary-color);
    color: white;
}

/* Language Toggle specific style - Updated for white header */
#lang-toggle-app {
    color: var(--primary-color);
    border: 1px solid rgba(37, 99, 235, 0.2);
}

#lang-toggle-app:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

@media (max-width: 768px) {
    header {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .header-brand {
        max-width: 100%;
        grid-column: auto;
    }

    .header-controls {
        width: 100%;
        justify-content: center;
        justify-self: auto;
    }
}

/* Project Info Header */
.project-info-display {
    text-align: center;
    margin: 2rem auto 1rem;
    display: flex;
    justify-content: center;
    gap: 3rem;
    /* Space between Project and Location */
    flex-wrap: wrap;
}

.info-item {
    font-size: 1.2rem;
    color: var(--primary-color);
}

.info-label {
    font-weight: bold;
    margin-right: 0.5rem;
    /* Space between label and value */
    color: var(--text-light);
}

[dir="rtl"] .info-label {
    margin-right: 0;
    margin-left: 0.5rem;
}

.info-value {
    font-weight: bold;
    color: var(--primary-color);
}

/* Search Container */
.search-container {
    max-width: 600px;
    margin: 0 auto 2rem;
    display: flex;
    gap: 1rem;
    position: relative;
    /* For autocomplete positioning */
}

.search-container input {
    flex: 1;
}

/* Autocomplete Styles */
.autocomplete-items {
    position: absolute;
    border: 1px solid #d4d4d4;
    border-bottom: none;
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.autocomplete-items div {
    padding: 10px;
    cursor: pointer;
    background-color: #fff;
    border-bottom: 1px solid #d4d4d4;
    text-align: left;
}

/* RTL Support for Autocomplete */
[dir="rtl"] .autocomplete-items div {
    text-align: right;
}

.autocomplete-items div:hover {
    background-color: #e9e9e9;
}

.autocomplete-active {
    background-color: var(--secondary-color) !important;
    color: #ffffff;
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Dashboard Cards */
.card {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Match site.css border */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    color: var(--text-main);
    text-decoration: none;
    /* Remove bottom border from old style */
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}


.card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.card-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* CRUD Modules */
.module-container {
    width: 80%;
    /* Requested 80% width */
    margin: 2rem auto;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #e2e8f0;
    /* Light Gray */
    color: var(--text-main);
    font-weight: 700;
}

tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    cursor: pointer;
    font-size: 1.5rem;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* RTL Support for Arabic */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .form-group {
    text-align: right;
}

[dir="rtl"] th,
[dir="rtl"] td {
    text-align: right;
}

[dir="rtl"] .header-brand {
    flex-direction: row-reverse;
    /* Keep logo on expected side if needed, or adjust */
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-color);
    /* Updated for better visibility, was text-light */
    font-size: 1.3rem;
    /* Increased size */
    font-weight: 500;
}

/* Date Column Styling */
@media (min-width: 769px) {
    .date-column {
        width: 1%;
        white-space: nowrap;
    }
}