/* css/style.css - v5 */
:root {
    --primary: #1e3a8a;
    --primary-light: #3b82f6;
    --success: #10b981;
    --danger: #ef4444;
    --bg: #f1f5f9;
    --text: #1e293b;
    --white: #ffffff;
    --border: #cbd5e1;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    direction: rtl;
}

body.ltr {
    font-family: 'Inter', sans-serif;
}

.hidden {
    display: none !important;
}

/* Login */
#login-screen {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

#login-screen .card {
    width: 380px;
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

#login-screen input {
    width: 100%;
    padding: 14px;
    margin-bottom: 15px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    outline: none;
    transition: 0.3s;
}

#login-screen input:focus {
    border-color: var(--primary-light);
}

/* Layout */
#app-container {
    width: 100%;
    height: 100vh;
    display: flex;
}

.sidebar {
    width: 260px;
    background: var(--white);
    border-left: 1px solid var(--border);
    padding: 25px 15px;
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.05);
}

.sidebar h3 {
    color: var(--primary);
    margin-bottom: 30px;
    text-align: center;
    font-size: 24px;
    font-weight: 800;
}

.nav-item {
    padding: 12px 18px;
    margin-bottom: 8px;
    border-radius: 12px;
    cursor: pointer;
    color: #64748b;
    font-weight: 600;
    display: flex;
    gap: 12px;
    align-items: center;
    transition: 0.3s;
}

.nav-item:hover {
    background: #f8fafc;
    color: var(--primary);
    transform: translateX(-5px);
}

.nav-item.active {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 6px -1px rgba(30, 58, 138, 0.3);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.page-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* UI Components */
.card {
    background: var(--white);
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
    margin-bottom: 25px;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

input,
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 5px;
    font-family: 'Tajawal';
    font-size: 14px;
    background: #fff;
}

input:focus,
select:focus {
    outline: 2px solid var(--primary-light);
    border-color: transparent;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-family: 'Tajawal';
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: 0.2s;
}

.btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-save {
    background: var(--primary);
    color: white;
}

.btn-delete {
    background: var(--danger);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: #64748b;
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Attendance Table Style */
.att-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.att-table th {
    text-align: right;
    color: #64748b;
    font-size: 13px;
    padding: 0 15px;
}

.att-table td {
    background: white;
    padding: 15px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.att-table td:first-child {
    border-radius: 0 12px 12px 0;
}

.att-table td:last-child {
    border-radius: 12px 0 0 12px;
}

.emp-row {
    transition: 0.2s;
}

.emp-row:hover td {
    background: #f8fafc;
    border-color: var(--primary-light);
}

/* MODAL (Time Popup) */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.modal-box {
    background: white;
    padding: 30px;
    width: 400px;
    border-radius: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    text-align: center;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Generic Modal (for edit modals) */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none !important;
}

.modal .modal-content {
    background: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: popIn 0.3s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

.modal .modal-content label {
    font-weight: 600;
    color: #64748b;
    font-size: 13px;
    display: block;
    margin-bottom: 5px;
}

.modal .modal-content .header-title {
    margin-bottom: 20px;
}

.time-input-group {
    display: flex;
    gap: 15px;
    margin: 20px 0;
}

.time-field {
    flex: 1;
    text-align: right;
}

.time-field label {
    font-size: 12px;
    color: #64748b;
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

.time-field input {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary);
    text-align: center;
    padding: 10px;
    background: #f1f5f9;
    border: 2px solid transparent;
}

.time-field input:focus {
    background: white;
    border-color: var(--primary);
}

/* Import Box */
.import-box {
    background: #fffbeb;
    border: 2px dashed #f59e0b;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: none;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: white;
    padding: 5px;
    border-radius: 12px;
    width: fit-content;
    border: 1px solid var(--border);
}

.tab {
    padding: 8px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    color: #64748b;
    transition: 0.2s;
}

.tab.active {
    background: var(--primary);
    color: white;
}

.badge {
    background: #ef4444;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    margin-right: 5px;
}

/* Notifications */
.notification-item:hover {
    transform: translateX(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.notification-item.unread {
    font-weight: 500;
}

.notification-item.read {
    opacity: 0.8;
}

/* Role Badge */
.role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.role-badge.admin {
    background: #fef3c7;
    color: #92400e;
}

.role-badge.hr {
    background: #dbeafe;
    color: #1e40af;
}

.role-badge.siteadmin {
    background: #d1fae5;
    color: #065f46;
}

/* Info Box for Profile */
.info-box {
    background: #f8fafc;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.info-box label {
    color: #94a3b8;
    font-size: 12px;
    display: block;
    margin-bottom: 5px;
}

.info-box div {
    font-weight: 600;
    color: #1e293b;
}

/* Request Card */
.request-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.2s;
}

.request-card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-light);
}

.request-card .emp-name {
    font-weight: 700;
    color: var(--primary);
    font-size: 16px;
}

.request-card .request-type {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.request-card .type-leave {
    background: #dcfce7;
    color: #166534;
}

.request-card .type-mission {
    background: #dbeafe;
    color: #1e40af;
}

.request-card .type-sick {
    background: #fef9c3;
    color: #854d0e;
}

/* Action Buttons */
.btn-approve {
    background: #10b981;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-approve:hover {
    background: #059669;
}

.btn-reject {
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-reject:hover {
    background: #dc2626;
}

/* Project Item */
.project-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 8px;
}

.project-item:hover {
    background: #f1f5f9;
}

/* Language Toggle Button */
.lang-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    padding: 10px 15px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.lang-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.lang-toggle-btn i {
    font-size: 16px;
}

/* LTR (Left-to-Right) Support for English */
body.ltr {
    direction: ltr;
    text-align: left;
}

body.ltr .sidebar {
    border-left: none;
    border-right: 1px solid var(--border);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.05);
}

body.ltr .nav-item {
    text-align: left;
}

body.ltr .nav-item:hover {
    transform: translateX(5px);
}

body.ltr .att-table th {
    text-align: left;
}

body.ltr .att-table td:first-child {
    border-radius: 12px 0 0 12px;
}

body.ltr .att-table td:last-child {
    border-radius: 0 12px 12px 0;
}

body.ltr .time-field {
    text-align: left;
}

body.ltr .badge {
    margin-right: 0;
    margin-left: 5px;
}

body.ltr .lm-tab i {
    margin-left: 0;
    margin-right: 8px;
}

body.ltr .notification-item:hover {
    transform: translateX(5px);
}

body.ltr .modal-box {
    text-align: left;
}

body.ltr .request-card {
    text-align: left;
}

body.ltr .info-box {
    text-align: left;
}

body.ltr .header-title {
    text-align: left;
}

@media print {
    .no-print {
        display: none !important;
    }
}

/* Choices.js RTL Support */
.choices.choices-rtl {
    direction: rtl;
    text-align: right;
}

.choices__inner {
    border-radius: 8px;
    padding: 8px 12px;
    min-height: 42px;
    border: 1px solid var(--border);
    background: #fff;
}

.choices__list--dropdown {
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.choices__list--dropdown .choices__item {
    padding: 10px 12px;
    text-align: right;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background: var(--primary-light);
    color: white;
}

.choices[data-type*=select-one] .choices__inner {
    padding-bottom: 8px;
}

.choices[data-type*=select-one]::after {
    left: auto;
    right: 11.5px;
}

.choices__input {
    font-family: 'Tajawal', sans-serif;
    direction: rtl;
}

.choices__placeholder {
    opacity: 0.6;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* Autocomplete Suggestions - حقل البحث التلقائي */
/* ═══════════════════════════════════════════════════════════════════════════ */
.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #cbd5e1;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.autocomplete-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
    font-size: 14px;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: #eff6ff;
    color: #1e40af;
}

.autocomplete-item .item-code {
    font-weight: 600;
    color: #1e40af;
    font-family: monospace;
}

.autocomplete-item .item-name {
    color: #334155;
}

.autocomplete-item .item-sub {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

.autocomplete-no-results {
    padding: 15px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

.autocomplete-clear-btn {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    padding: 5px;
    display: none;
}

.autocomplete-clear-btn:hover {
    color: #ef4444;
}

input:not(:placeholder-shown) + .autocomplete-clear-btn {
    display: block;
}