/* Y-HR System v3.0 - Styles */
/* جميع الحقوق محفوظة © 2026 لـ YUOSEF ALDHUMAYRI */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap');

:root {
    --primary: #0066FF;
    --primary-dark: #0052cc;
    --primary-light: #e6f0ff;
    --secondary: #00D4AA;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --dark: #0A1628;
    --gray: #6c757d;
    --light: #f8f9fa;
    --border: #e9ecef;
    --shadow: 0 2px 15px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-width: 260px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Tajawal', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    direction: rtl;
    min-height: 100vh;
    font-size: 14px;
    color: #333;
    line-height: 1.6;
}

a { text-decoration: none; color: inherit; transition: var(--transition); }
a:hover { color: var(--primary); }
img { max-width: 100%; height: auto; }

/* =============================================
   Scrollbar
============================================= */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }

/* =============================================
   Sidebar
============================================= */
.sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--dark) 0%, #162035 100%);
    color: #fff;
    z-index: 1000;
    overflow-y: auto;
    transition: var(--transition);
    box-shadow: -5px 0 25px rgba(0,0,0,0.15);
}

.sidebar-header {
    padding: 25px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.1);
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.sidebar-header .logo-icon {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.sidebar-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, #ccc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar nav { padding: 15px 0; }

.nav-section {
    padding: 15px 20px 8px;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    letter-spacing: 1.5px;
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    transition: var(--transition);
    border-right: 3px solid transparent;
    margin: 2px 8px 2px 0;
    border-radius: 0 8px 8px 0;
    font-size: 0.9rem;
}

.nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    transform: translateX(-3px);
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(0,102,255,0.2), transparent);
    color: var(--primary);
    border-right-color: var(--primary);
}

.nav-link i {
    width: 22px;
    text-align: center;
    font-size: 1rem;
    opacity: 0.8;
}

.nav-link .badge {
    margin-right: auto;
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: 10px;
}

/* =============================================
   Main Content
============================================= */
.main-content {
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    padding: 20px;
    transition: var(--transition);
}

/* Top Bar */
.top-bar {
    background: #fff;
    padding: 15px 25px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.top-bar h1 {
    font-size: 1.3rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.top-bar h1 i {
    color: var(--primary);
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    background: var(--light);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
}

.notification-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--light);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--gray);
    transition: var(--transition);
}

.notification-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.notification-btn .count {
    position: absolute;
    top: -2px;
    left: -2px;
    width: 18px;
    height: 18px;
    background: var(--danger);
    color: #fff;
    border-radius: 50%;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =============================================
   Cards
============================================= */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.03);
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, #fff, #fcfcfc);
}

.card-header h3 {
    font-size: 1rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.card-header h3 i {
    color: var(--primary);
}

.card-body { padding: 22px; }

.card-footer {
    padding: 15px 22px;
    border-top: 1px solid var(--border);
    background: #fafbfc;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

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

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.02);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    opacity: 0;
    transition: var(--transition);
}

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

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 58px;
    height: 58px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    flex-shrink: 0;
}

.stat-icon.blue { background: linear-gradient(135deg, #0066FF, #4834d4); }
.stat-icon.green { background: linear-gradient(135deg, #00D4AA, #00b894); }
.stat-icon.orange { background: linear-gradient(135deg, #f39c12, #e67e22); }
.stat-icon.red { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.stat-icon.purple { background: linear-gradient(135deg, #9b59b6, #8e44ad); }
.stat-icon.cyan { background: linear-gradient(135deg, #00cec9, #0984e3); }
.stat-icon.pink { background: linear-gradient(135deg, #fd79a8, #e84393); }
.stat-icon.teal { background: linear-gradient(135deg, #1abc9c, #16a085); }

.stat-info { flex: 1; }

.stat-info h3 {
    font-size: 1.8rem;
    margin-bottom: 4px;
    color: var(--dark);
    font-weight: 700;
}

.stat-info p {
    color: var(--gray);
    margin: 0;
    font-size: 0.9rem;
}

/* =============================================
   Tables
============================================= */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 14px 16px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table th {
    background: linear-gradient(to bottom, #f8f9fa, #f1f3f4);
    font-weight: 600;
    color: var(--dark);
    font-size: 0.85rem;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: #f8f9fa;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.emp-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.emp-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.emp-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.emp-details strong {
    display: block;
    margin-bottom: 2px;
    color: var(--dark);
}

.emp-details small {
    color: var(--gray);
    font-size: 0.8rem;
}

/* =============================================
   Forms
============================================= */
.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
    font-size: 0.9rem;
}

.form-group label .required {
    color: var(--danger);
    margin-right: 3px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
    background: #fff;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0,102,255,0.1);
}

.form-control:disabled, .form-control[readonly] {
    background: #f5f5f5;
    cursor: not-allowed;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 15px center;
    padding-left: 40px;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-row-3 { grid-template-columns: repeat(3, 1fr); }
.form-row-4 { grid-template-columns: repeat(4, 1fr); }

.form-text {
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 6px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* =============================================
   Buttons
============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}

.btn-secondary { background: var(--gray); color: #fff; }
.btn-success { background: linear-gradient(135deg, var(--success), #1e7e34); color: #fff; }
.btn-danger { background: linear-gradient(135deg, var(--danger), #bd2130); color: #fff; }
.btn-warning { background: linear-gradient(135deg, var(--warning), #e0a800); color: #333; }
.btn-info { background: linear-gradient(135deg, var(--info), #138496); color: #fff; }
.btn-light { background: #fff; color: var(--dark); border: 1px solid var(--border); }
.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}
.btn-outline:hover {
    background: var(--primary);
    color: #fff;
}

.btn-sm { padding: 7px 14px; font-size: 0.85rem; }
.btn-lg { padding: 14px 30px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 10px; width: 40px; height: 40px; border-radius: var(--radius-sm); }
.btn-icon-sm { padding: 6px; width: 32px; height: 32px; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* =============================================
   Badges
============================================= */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #d4edda; color: #155724; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-secondary { background: #e9ecef; color: #495057; }

/* =============================================
   Alerts
============================================= */
.alert {
    padding: 16px 22px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
    border-right: 4px solid;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-success { background: #d4edda; color: #155724; border-color: var(--success); }
.alert-danger { background: #f8d7da; color: #721c24; border-color: var(--danger); }
.alert-warning { background: #fff3cd; color: #856404; border-color: var(--warning); }
.alert-info { background: #d1ecf1; color: #0c5460; border-color: var(--info); }

/* =============================================
   Modal
============================================= */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal.show { display: flex; }

.modal-content {
    background: #fff;
    border-radius: var(--radius);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlide 0.3s ease;
    box-shadow: var(--shadow-lg);
}

@keyframes modalSlide {
    from { opacity: 0; transform: scale(0.95) translateY(-20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-lg { max-width: 900px; }
.modal-xl { max-width: 1200px; }

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, #fff, #f8f9fa);
}

.modal-header h3 {
    font-size: 1.15rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-body { padding: 25px; }

.modal-footer {
    padding: 18px 25px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #f8f9fa;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--gray);
    padding: 5px;
    line-height: 1;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-btn:hover {
    color: var(--danger);
    background: #fee;
}

/* =============================================
   Tabs
============================================= */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 25px;
    gap: 5px;
    overflow-x: auto;
}

.tab-link {
    padding: 14px 24px;
    color: var(--gray);
    font-weight: 500;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    white-space: nowrap;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab-link:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.tab-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--primary-light);
}

.tab-content { display: none; animation: fadeIn 0.3s; }
.tab-content.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* =============================================
   Filter Bar
============================================= */
.filter-bar {
    background: #fff;
    padding: 18px 22px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.filter-form {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-form .form-group {
    margin-bottom: 0;
    min-width: 160px;
}

.filter-form .form-group label {
    font-size: 0.8rem;
    margin-bottom: 6px;
}

/* =============================================
   Empty State
============================================= */
.empty-state {
    text-align: center;
    padding: 60px 30px;
    color: var(--gray);
}

.empty-state i {
    font-size: 4.5rem;
    margin-bottom: 20px;
    opacity: 0.3;
    color: var(--primary);
}

.empty-state h4 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: var(--dark);
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 25px;
}

/* =============================================
   File Upload
============================================= */
.file-upload {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 35px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: #fafbfc;
}

.file-upload:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-upload.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-upload i {
    font-size: 3rem;
    color: var(--gray);
    margin-bottom: 15px;
}

.file-upload input[type="file"] { display: none; }

/* =============================================
   Progress
============================================= */
.progress {
    height: 10px;
    background: var(--border);
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    transition: width 0.5s ease;
    border-radius: 5px;
}

/* =============================================
   Print Styles
============================================= */
.print-only { display: none; }

@media print {
    body { background: #fff !important; }
    .sidebar, .top-bar, .btn, .no-print, .filter-bar { display: none !important; }
    .main-content { margin: 0 !important; padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
    .print-only { display: block !important; }
}

/* =============================================
   Services Grid (Employee Portal)
============================================= */
.services-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 25px;
}

.service-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: var(--shadow);
}

.service-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.service-card i {
    font-size: 2.5rem;
    margin-bottom: 15px;
    display: block;
}

.service-card h4 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--dark);
    font-weight: 600;
}

/* =============================================
   Footer
============================================= */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--gray);
    font-size: 0.85rem;
    margin-top: 30px;
    border-top: 1px solid var(--border);
    background: #fff;
    border-radius: var(--radius);
}

.footer a {
    color: var(--primary);
    font-weight: 500;
}

/* =============================================
   Letter Print
============================================= */
.letter-container {
    background: #fff;
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
    border: 1px solid #ddd;
}

.letter-header {
    text-align: center;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.letter-header img {
    max-height: 80px;
    margin-bottom: 15px;
}

.letter-body {
    line-height: 2;
    font-size: 1rem;
}

.letter-footer {
    margin-top: 50px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.letter-signature {
    text-align: center;
}

.letter-signature img {
    max-height: 60px;
    margin-bottom: 10px;
}

.letter-qr {
    text-align: center;
}

.letter-qr img {
    width: 100px;
    height: 100px;
}

/* =============================================
   Responsive
============================================= */
@media (max-width: 1200px) {
    .services-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 992px) {
    .sidebar { transform: translateX(100%); }
    .sidebar.active { transform: translateX(0); }
    .main-content { margin-right: 0; }
    .form-row, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .services-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 576px) {
    .stats-grid { grid-template-columns: 1fr; }
    .services-grid { grid-template-columns: 1fr; }
    .top-bar { flex-direction: column; gap: 15px; text-align: center; }
    .top-bar h1 { font-size: 1.1rem; }
    .table th, .table td { padding: 10px 8px; font-size: 0.85rem; }
    .modal-content { margin: 10px; border-radius: var(--radius-sm); }
    .btn { padding: 10px 16px; font-size: 0.9rem; }
}
