@import url('https://fonts.googleapis.com/css2?family=Almarai:wght@300;400;700;800&family=Cairo:wght@400;600;700;800&display=swap');

:root {
    --primary: #009688;
    --primary-dark: #00796b;
    --primary-light: #b2dfdb;
    --dark: #1e272e;
    --sidebar-bg: #1e272e;
    --bg-light: #f4f7f6;
    --text-color: #333;
    --white: #ffffff;
    --glass: rgba(255, 255, 255, 0.95);
    --border: #e0e0e0;
    --shadow: 0 2px 15px rgba(0,0,0,0.05);
}

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

body {
    background-color: var(--bg-light);
    color: var(--text-color);
    font-family: 'Cairo', 'Almarai', sans-serif;
    direction: rtl;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Sidebar */
.sidebar {
    width: 230px; 
    background: var(--sidebar-bg);
    color: #fff;
    height: 100vh;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-content {
    margin-right: 230px;
    width: calc(100% - 230px);
    min-height: 100vh;
    background: var(--bg-light);
}

.top-header {
    height: 50px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    position: fixed;
    top: 0;
    right: 230px;
    left: 0;
    width: calc(100% - 230px);
    z-index: 900;
    border-bottom: 1px solid var(--border);
}

.page-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--dark);
    letter-spacing: -0.5px;
}

.content-area {
    padding: 20px;
    padding-top: 80px;
}

.card {
    background: var(--white);
    border-radius: 16px;
    padding: 25px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 25px;
}

/* PREMIUM FORM FIELDS */
.form-group {
    position: relative;
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
    padding-right: 5px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    right: 15px;
    color: var(--primary);
    font-size: 16px;
    transition: 0.3s;
}

.form-control, .search-input {
    width: 100%;
    padding: 12px 45px 12px 12px;
    background: #FFFFFF;
    border: 1.5px solid #E5E1D8;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Almarai', sans-serif;
    color: var(--dark);
    transition: all 0.2s ease;
}

.form-control:focus, .search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 10px 25px rgba(212, 175, 55, 0.15);
    transform: translateY(-2px);
}

.form-control:focus + i, .search-input:focus + i {
    color: var(--primary-dark);
    transform: scale(1.1);
}

.form-control::placeholder {
    color: #bbb;
    font-weight: 400;
}

select.form-control {
    appearance: none;
    cursor: pointer;
}

/* Sidebar Styling */
.sidebar-header {
    padding: 15px 10px;
    text-align: center;
    background: rgba(0,0,0,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.03);
    white-space: nowrap;
}

.logo-text {
    font-size: 18px;
    font-weight: 900;
    color: var(--primary);
    font-family: 'Cairo', sans-serif;
    transition: 0.3s;
}

/* sidebar always expanded - no hidden text */

.logo-sub {
    font-size: 11px;
    color: #888;
    font-weight: 700;
    transition: 0.3s;
    margin-top: 2px;
}

/* Logo sub is hidden via the rule above */

.user-panel {
    padding: 12px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(212,175,55,0.02);
    border-bottom: 1px solid rgba(255,255,255,0.02);
    overflow: hidden;
}


.user-avatar {
    min-width: 38px;
    height: 38px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #111;
    font-size: 18px;
}

.user-details {
    transition: 0.3s;
    white-space: nowrap;
}


.user-name {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
}

.user-role {
    font-size: 11px;
    color: var(--primary);
    font-weight: 700;
    opacity: 0.8;
}

.nav-menu { 
    flex: 1; 
    padding: 20px 15px; 
    overflow-y: auto;
    scrollbar-width: none;
}
.nav-menu::-webkit-scrollbar { display: none; }

.nav-item {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 8px 12px !important;
    color: #b5ada3 !important;
    text-decoration: none !important;
    border-radius: 10px !important;
    margin: 3px 8px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
}

.nav-item i {
    min-width: 18px;
    text-align: center;
    font-size: 16px;
}

.nav-item span {
    transition: 0.3s;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}


.nav-item:hover { 
    background: rgba(255,255,255,0.08) !important; 
    color: var(--primary) !important; 
}

.nav-item.active { 
    background: var(--primary); 
    color: #111; 
    font-weight: 800; 
}

.submenu {
    display: none;
    background: rgba(0,0,0,0.2);
    border-radius: 15px;
    margin: 5px 12px;
    padding: 8px 0;
    border: 1px solid rgba(255,255,255,0.03);
}

.sub-item {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 8px 15px !important;
    color: #e0e0e0 !important;
    text-decoration: none !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
    border-radius: 8px !important;
    margin: 3px 10px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.sub-item i {
    font-size: 14px;
    opacity: 0.7;
    width: 18px;
    text-align: center;
}

.sub-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);

}

.sub-item.active {
    color: var(--primary);
    font-weight: 900;
}




.sub-item:hover, .sub-item.active { color: var(--primary); }

.sidebar-footer {
    padding: 10px 15px;
    margin-top: auto;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    color: #ff5252;
    text-decoration: none;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    font-weight: 800;
    transition: all 0.3s ease;
    font-size: 13px;
    white-space: nowrap;
}

.logout-btn:hover {
    background: rgba(255,82,82,0.1);
    transform: translateY(-2px);
}

.logout-btn i {
    font-size: 18px;
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: #111;
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    font-weight: 800;
    font-size: 14px;
    font-family: 'Almarai', sans-serif;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(212,175,55,0.3); background: var(--primary-dark); }

/* Data Table Styling */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 10px;
}

.data-table th {
    background: #F1EFE9;
    color: var(--dark);
    font-weight: 800;
    padding: 15px;
    text-align: right;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--primary-light);
}

.data-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #EEEBE3;
    font-size: 14px;
    color: #444;
}

.data-table tr:hover td {
    background: #FAF9F6;
    color: #000;
}

/* Status Badges */
.status-badge {
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
    display: inline-block;
}

.status-active { background: #E3FCEF; color: #00875A; }
.status-withdrawn { background: #FFE9E9; color: #E74C3C; }
.status-other { background: #F4F5F7; color: #5E6C84; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stats-card {
    background: #fff;
    padding: 12px 15px;
    border-radius: 14px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: 0.2s;
}

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

.stats-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.stats-info h3 { font-size: 18px; font-weight: 800; margin: 0; color: var(--dark); }
.stats-info p { font-size: 11px; color: #888; margin: 0; font-weight: 600; }

.alert {
    padding: 18px 25px;
    border-radius: 16px;
    margin-bottom: 25px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success { background: #E3FCEF; color: #00875A; border: 1px solid #ABF5D1; }
.alert-danger { background: #FFE9E9; color: #BF2600; border: 1px solid #FFBDAD; }

/* Employee Avatars */
.emp-avatar {
    width: 80px !important;
    height: 80px !important;
    border-radius: 10px;
    object-fit: contain; /* Show the full image without cropping */
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease-in-out;
    image-rendering: -webkit-optimize-contrast;
    display: block;
    margin: auto;
}

.emp-avatar:hover {
    transform: scale(2.0);
    z-index: 999;
    position: relative;
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
    border-color: var(--primary);
}

.emp-avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 30px;
    border: 1px dashed #ddd;
    margin: auto;
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    bottom: 30px;
    right: 30px; /* RTL alignment */
    background: #2E7D32;
    color: white;
    padding: 18px 30px;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 15px;
    transform: translateY(100px);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    opacity: 0;
    font-weight: 700;
}
.toast-notification.show {
    transform: translateY(0);
    opacity: 1;
}
.toast-notification i {
    font-size: 20px;
}
.toast-error {
    background: #D32F2F;
}

.toast-info {
    background: #B8860B; /* Golden Caramel */
    color: white;
}

/* Toggle Switch CSS */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(10, 16, 21, 0.85);
    backdrop-filter: blur(12px);
}

.modal-content {
    background-color: #fff;
    margin: 2% auto;
    padding: 0;
    border-radius: 35px;
    width: 800px; 
    max-width: 95%;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    position: relative;
    animation: modalSlideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255,255,255,0.1);
}

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

.modal-header {
    background: linear-gradient(135deg, #0a1015 0%, #16212c 100%);
    color: white;
    padding: 20px 30px; 
    display: flex;
    align-items: center;
    gap: 20px;
    border-bottom: 3px solid var(--primary);
    position: relative;
}

.modal-header .emp-photo {
    width: 80px; 
    height: 80px;
    border-radius: 20px;
    border: 3px solid var(--primary);
    object-fit: contain;
    background: white;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.modal-header .emp-info h2 {
    font-size: 26px; 
    margin: 0;
    font-weight: 900;
    font-family: 'Cairo', sans-serif;
    color: #fff;
    letter-spacing: -0.5px;
}

.modal-header .emp-info p {
    color: var(--primary);
    font-weight: 700;
    margin-top: 5px;
    font-size: 14px;
    opacity: 0.9;
    letter-spacing: 0.5px;
}

#empModal .modal-body {
    padding: 20px 30px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px; 
}

.modal-body {
    padding: 20px 30px;
}

.detail-item {
    background: #fdfdfd;
    padding: 16px 20px;
    border-radius: 15px;
    border: 1px solid #f2f2f2;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
    min-height: 90px;
}

.detail-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
    transform: scaleX(0);
    transition: transform 0.4s ease;
    transform-origin: right;
}

.detail-item:hover {
    background: #fff;
    border-color: var(--primary-light);
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 150, 136, 0.08);
}

.detail-item:hover::after {
    transform: scaleX(1);
}

.detail-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    text-transform: uppercase;
    color: #99aab5;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

.detail-item label i {
    color: var(--primary);
    font-size: 12px;
    width: 15px;
    text-align: center;
}

.detail-item span {
    font-size: 15px;
    color: var(--dark);
    font-weight: 800;
    font-family: 'Cairo', sans-serif;
    white-space: normal;
    word-break: break-word;
    line-height: 1.5;
}

.close-modal {
    position: absolute;
    top: 15px;
    left: 15px;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    opacity: 0.5;
    transition: 0.3s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-modal:hover { 
    opacity: 1; 
    background: rgba(255,255,255,0.1);
    transform: rotate(90deg); 
}

.data-table tbody tr {
    cursor: pointer;
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: rgba(212,175,55,0.05) !important;
}

.job-cell, .name-cell {
    white-space: normal !important;
    max-width: 220px;
    min-width: 180px;
    line-height: 1.5 !important;
    font-weight: 700 !important;
}

.name-cell {
    min-width: 200px;
}

.code-cell {
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.mobile-cell {
    color: #1976D2;
    font-size: 12px;
    font-weight: 700;
    font-family: monospace;
}

.detail-item span {
    font-size: 15px;
    color: var(--dark);
    font-weight: 800;
}

/* Sync Modal Styles */
.sync-pulse {
    width: 100px;
    height: 100px;
    background: rgba(0, 121, 107, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    font-size: 40px;
    color: var(--primary);
    position: relative;
}

.sync-pulse.spinning i {
    animation: fa-spin 2s infinite linear;
}

.sync-pulse::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid var(--primary);
    border-radius: 50%;
    animation: sync-ripple 1.5s infinite;
}

@keyframes sync-ripple {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

.sync-steps {
    text-align: right;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 20px;
    margin-bottom: 20px;
}

.sync-step {
    padding: 10px 0;
    color: #888;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #eee;
}

.sync-step:last-child { border-bottom: none; }

.sync-step i { font-size: 12px; }

.sync-step.active {
    color: var(--dark);
}

.sync-step.done {
    color: var(--primary-dark);
}

.sync-step.done i {
    color: var(--primary);
}