/* SAP Migration Portal - HR System Theme */
/* Based on HR Pro System Design */

:root {
    --primary: #1e3a8a;
    --primary-light: #3b82f6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --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);
    direction: rtl;
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* ============================================
   LAYOUT
   ============================================ */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.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);
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    margin-bottom: 30px;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.logo-icon {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
}

.logo-text {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
}

.nav-menu {
    flex: 1;
}

.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;
    border: none;
    background: none;
    width: 100%;
    text-align: right;
    font-size: 14px;
    font-family: 'Tajawal', sans-serif;
}

.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);
}

.nav-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-right: 260px;
    padding: 25px;
    max-width: 1200px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Screens */
.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   CARDS
   ============================================ */
.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;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ============================================
   STATS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

.stat-card.accent-info {
    border-right: 4px solid var(--primary-light);
}

.stat-card.accent-success {
    border-right: 4px solid var(--success);
}

.stat-card.accent-warning {
    border-right: 4px solid var(--warning);
}

.stat-card.accent-danger {
    border-right: 4px solid var(--danger);
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: #f1f5f9;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 15px;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

.stat-label {
    color: #64748b;
    font-size: 14px;
    margin-top: 5px;
}

/* ============================================
   PROGRESS
   ============================================ */
.progress-container {
    margin-bottom: 20px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 600;
}

.progress-bar-bg {
    height: 12px;
    background: #e2e8f0;
    border-radius: 20px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 20px;
    transition: width 0.5s ease;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-family: 'Tajawal', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: 0.2s;
}

.btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-primary,
.btn-save {
    background: var(--primary);
    color: white;
}

.btn-primary:hover,
.btn-save:hover {
    background: var(--primary-light);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

.btn-secondary {
    background: #e2e8f0;
    color: #64748b;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger,
.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);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
}

.btn-group {
    display: flex;
    gap: 10px;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th,
td {
    padding: 15px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

th {
    background: #f8fafc;
    font-weight: 600;
    color: #64748b;
    font-size: 13px;
}

tr:hover td {
    background: #f8fafc;
}

tr:last-child td {
    border-bottom: none;
}

.text-left {
    text-align: left;
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-block;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    background: var(--primary);
    color: white;
}

.badge-supplier {
    background: #dbeafe;
    color: #1e40af;
}

.badge-subcontractor {
    background: #dcfce7;
    color: #166534;
}

.badge-creditor {
    background: #fef3c7;
    color: #92400e;
}

.badge-employee {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-unknown {
    background: #fef2f2;
    color: #b91c1c;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-processing {
    background: #dbeafe;
    color: #1e40af;
}

.status-completed {
    background: #dcfce7;
    color: #166534;
}

.status-approved {
    background: #e0e7ff;
    color: #3730a3;
}

.status-draft {
    background: #f1f5f9;
    color: #64748b;
}

.status-pending_review {
    background: #fef3c7;
    color: #92400e;
}

.status-exported {
    background: #dcfce7;
    color: #166534;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #64748b;
    font-size: 13px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    background: #fff;
    transition: all 0.2s;
}

.form-control:focus {
    outline: 2px solid var(--primary-light);
    border-color: transparent;
}

.form-control::placeholder {
    color: #94a3b8;
}

select.form-control {
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.form-hint {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 5px;
}

code {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    color: var(--primary);
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: popIn 0.3s ease-out;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

/* ============================================
   FILE UPLOAD
   ============================================ */
.file-upload {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 15px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    cursor: pointer;
    transition: all 0.3s;
    background: #f8fafc;
}

.file-upload:hover {
    border-color: var(--primary-light);
    background: #eff6ff;
}

.file-upload-icon {
    font-size: 24px;
    color: var(--primary-light);
    margin-bottom: 0;
}

.file-upload-text {
    color: #64748b;
    text-align: right;
    flex: 1;
}

.file-upload-btn {
    margin-top: 0;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
}

.empty-state-icon {
    font-size: 60px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--white);
    color: var(--text);
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 4000;
    opacity: 0;
    transition: all 0.3s ease;
    font-weight: 600;
    border-right: 4px solid var(--primary);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-success {
    border-right-color: var(--success);
}

.toast-error {
    border-right-color: var(--danger);
}

.toast-warning {
    border-right-color: var(--warning);
}

.toast-info {
    border-right-color: var(--primary-light);
}

/* ============================================
   ICONS (Simple CSS)
   ============================================ */
.icon-dashboard::before {
    content: '📊';
}

.icon-settings::before {
    content: '⚙️';
}

.icon-import::before {
    content: '📥';
}

.icon-vendors::before {
    content: '👥';
}

.icon-export::before {
    content: '📤';
}

.icon-edit::before {
    content: '✏️';
}

.icon-delete::before {
    content: '🗑️';
}

.icon-check::before {
    content: '✓';
}

.icon-close::before {
    content: '✕';
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        overflow-x: auto;
        padding: 15px;
    }

    .sidebar-header {
        display: none;
    }

    .nav-menu {
        display: flex;
        gap: 10px;
    }

    .nav-item {
        white-space: nowrap;
        padding: 10px 15px;
    }

    .nav-item span {
        display: none;
    }

    .main-content {
        margin-right: 0;
        padding: 15px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
}

@media print {
    .no-print {
        display: none !important;
    }
}