/* ==============================================
   HR System — Base CSS
   الستايل المشترك لكل الصفحات
   ============================================== */

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

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #f5f5f5;
    color: #2c3e50;
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
}

.container { max-width: 1200px; margin: 0 auto; }

/* ============ المتغيرات ============ */
:root {
    --primary: #3498db;
    --primary-dark: #2980b9;
    --success: #27ae60;
    --warning: #e67e22;
    --danger: #e74c3c;
    --dark: #2c3e50;
    --gray: #7f8c8d;
    --light: #ecf0f1;
    --bg: #f5f5f5;
    --white: #ffffff;
    --border: #ecf0f1;
    
    --shadow-sm: 0 2px 10px rgba(0,0,0,0.05);
    --shadow-md: 0 8px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 28px rgba(0,0,0,0.12);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 12px;
}

/* ============ Typography ============ */
h1 { font-size: 22px; font-weight: 700; color: var(--dark); }
h2 { font-size: 18px; font-weight: 700; color: var(--dark); margin-bottom: 15px; }
h3 { font-size: 16px; font-weight: 700; color: var(--dark); }
p  { color: var(--gray); }

/* ============ Header ============ */
.header {
    background: var(--white);
    padding: 20px 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.header h1 { font-size: 20px; }

.role {
    background: linear-gradient(135deg, var(--warning), #d35400);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* ============ Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: none;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #1e8449; transform: translateY(-2px); }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d35400; transform: translateY(-2px); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c0392b; transform: translateY(-2px); }

.btn-gray { background: #95a5a6; color: white; }
.btn-gray:hover { background: #7f8c8d; transform: translateY(-2px); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }

/* ============ Cards / Sections ============ */
.section {
    background: var(--white);
    padding: 25px 30px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.section h2 {
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

/* ============ Tables ============ */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

th, td {
    padding: 12px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

th {
    background: #f8f9fa;
    color: var(--dark);
    font-weight: 700;
    font-size: 12px;
}

tr:hover { background: #fafbfc; }

/* ============ Badges ============ */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}

.badge-success { background: #d5f4e6; color: var(--success); }
.badge-warning { background: #fdebd0; color: var(--warning); }
.badge-danger  { background: #fadbd8; color: var(--danger); }
.badge-info    { background: #d1ecf1; color: var(--primary); }
.badge-gray    { background: var(--light); color: var(--gray); }

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

.form-group label {
    display: block;
    color: var(--dark);
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--dark);
    background: white;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group textarea { resize: vertical; min-height: 80px; }

/* ============ Empty State ============ */
.empty {
    text-align: center;
    color: #95a5a6;
    padding: 40px 20px;
    font-size: 14px;
}

.empty-icon { font-size: 48px; display: block; margin-bottom: 10px; opacity: 0.5; }

/* ============ Messages ============ */
.messages { margin-bottom: 15px; }

.message, .msg {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 14px;
}

.message.success, .msg.success { background: #d4edda; color: #155724; border-right: 4px solid #28a745; }
.message.error,   .msg.error   { background: #f8d7da; color: #721c24; border-right: 4px solid #dc3545; }
.message.warning, .msg.warning { background: #fff3cd; color: #856404; border-right: 4px solid #ffc107; }
.message.info,    .msg.info    { background: #d1ecf1; color: #0c5460; border-right: 4px solid #17a2b8; }

/* ============ Modal ============ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-overlay.active { display: flex; }

.modal {
    background: white;
    border-radius: var(--radius-md);
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal h3 { margin-bottom: 20px; font-size: 20px; }

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.modal-btn {
    padding: 10px 25px;
    border-radius: var(--radius-sm);
    border: none;
    font-weight: 700;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
}

.modal-btn.cancel { background: var(--light); color: var(--dark); }
.modal-btn.save   { background: var(--success); color: white; }

/* ============ Responsive ============ */
@media (max-width: 900px) {
    .header { padding: 15px 20px; }
    .section { padding: 18px 20px; }
}

@media (max-width: 600px) {
    body { padding: 12px; }
    h1 { font-size: 18px; }
    h2 { font-size: 16px; }
}

/* ============ Utility Classes ============ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }

.hidden { display: none !important; }

/* ============ Header Actions ============ */
.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-toggle {
    background: white;
    color: var(--dark);
    border: 2px solid var(--border);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    min-width: 45px;
}

.btn-toggle:hover {
    background: var(--border);
    transform: translateY(-2px);
}

/* ============ Dark Mode ============ */
body.dark-theme {
    background: #1a1a24;
    color: #f0f0f0;
}

body.dark-theme .header,
body.dark-theme .section,
body.dark-theme .modal {
    background: #232335;
    color: #f0f0f0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

body.dark-theme h1,
body.dark-theme h2,
body.dark-theme h3 {
    color: #f0f0f0;
}

body.dark-theme p {
    color: #b0b0c0;
}

body.dark-theme .btn-toggle {
    background: #232335;
    color: #f0f0f0;
    border-color: #33334a;
}

body.dark-theme .btn-toggle:hover {
    background: #33334a;
}

body.dark-theme table {
    background: #232335;
    color: #f0f0f0;
}

body.dark-theme th {
    background: #2a2a3e;
    color: #f0f0f0;
}

body.dark-theme td {
    border-bottom-color: #33334a;
    color: #f0f0f0;
}

body.dark-theme tr:hover {
    background: #2a2a3e;
}

body.dark-theme .form-group input,
body.dark-theme .form-group select,
body.dark-theme .form-group textarea {
    background: #2a2a3e;
    color: #f0f0f0;
    border-color: #33334a;
}

body.dark-theme .empty {
    color: #707088;
}

body.dark-theme .section h2 {
    border-bottom-color: #33334a;
}