/* ==========================================================================
   Theme Tokens & Modern SaaS UI Variables
   طراحی مینیمال، استاندارد و شیک سازمانی
   ========================================================================== */

@font-face {
    font-family: 'Vazir';
    src: url('../fonts/vazir/Vazir-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'Vazir';
    src: url('../fonts/vazir/Vazir-Bold.woff2') format('woff2');
    font-weight: bold;
    font-style: normal;
}

:root {
    /* Palette: Corporate Trust & Clarity */
    --hk-primary: #2563eb;
    --hk-primary-hover: #1d4ed8;
    --hk-primary-light: #eff6ff;
    
    --hk-dark: #0f172a;
    --hk-dark-light: #334155;
    
    --hk-success: #059669;
    --hk-success-hover: #047857;
    --hk-success-light: #ecfdf5;
    
    --hk-danger: #dc2626;
    --hk-danger-hover: #b91c1c;
    --hk-danger-light: #fef2f2;
    
    --hk-warning: #d97706;
    --hk-warning-light: #fffbeb;

    --hk-bg: #f8fafc;
    --hk-card: #ffffff;
    
    --hk-text: #334155;
    --hk-text-light: #64748b;
    --hk-text-muted: #94a3b8;
    
    --hk-border: #e2e8f0;
    --hk-border-focus: #93c5fd;
    
    --hk-radius-lg: 24px;
    --hk-radius: 12px;
    --hk-radius-sm: 12px;

    /* Soft, diffused SaaS shadows */
    --hk-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --hk-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --hk-shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.025);
    --hk-shadow-float: 0 20px 25px -5px rgb(0 0 0 / 0.05), 0 8px 10px -6px rgb(0 0 0 / 0.05);
    
    --hk-font: 'Vazir', Tahoma, sans-serif;
    --hk-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    
    --hk-bg: #f1f5f9;
}

/* ==========================================================================
   Base & Typography
   ========================================================================== */
html, body, h2, #wpwrap, .hk-wrapper, .hk-wrapper-personnel-app, .hk-wrapper *, .hk-wrapper-personnel-app * {
    font-family: var(--hk-font) !important;
    box-sizing: border-box;
}

.hk-wrapper-personnel-app, .hk-wrapper {
    direction: rtl;
    text-align: right;
    background: var(--hk-bg);
    min-height: 100vh;
    color: var(--hk-text);
    line-height: 1.6;
}

.hk-wrapper-personnel-app { padding: 0 0 60px 0; }
.hk-wrapper { padding: 30px; }

/* ==========================================================================
   Layout Components
   ========================================================================== */
.hk-personnel-app-bar {
    background: #ffffff;
    padding: 16px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--hk-border);
    margin-bottom: 30px;
}

.hk-app-bar-brand { display: flex; align-items: center; gap: 16px; }
.hk-brand-icon { font-size: 24px; background: var(--hk-primary-light); color: var(--hk-primary); padding: 10px; border-radius: var(--hk-radius); }
.hk-app-bar-brand h1 { margin: 0; font-size: 20px; font-weight: 800; color: var(--hk-dark); }
.hk-app-bar-brand small { display: block; color: var(--hk-text-light); font-weight: 600; font-size: 13px; }

.hk-app-bar-user { display: flex; align-items: center; gap: 24px; }
.hk-user-info { text-align: left; display: flex; flex-direction: column; }
.hk-user-info strong { font-size: 14px; color: var(--hk-dark); }
.hk-user-info span { font-size: 12px; color: var(--hk-text-light); }

.hk-personnel-card, .hk-card {
    background: var(--hk-card);
    padding: 32px;
    border-radius: var(--hk-radius-lg);
    box-shadow: var(--hk-shadow-sm);
    border: 1px solid var(--hk-border);
    margin-bottom: 24px;
    transition: var(--hk-transition);
}

.hk-personnel-card { margin-left: 40px; margin-right: 40px; }
.hk-personnel-card:hover, .hk-card:hover { box-shadow: var(--hk-shadow); }

.hk-card-title {
    margin-top: 0;
    margin-bottom: 24px;
    font-size: 18px;
    font-weight: 800;
    color: var(--hk-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ==========================================================================
   Navigation & Tabs
   ========================================================================== */
.hk-personnel-navigation-tabs { display: flex; gap: 12px; padding: 0 40px; margin-bottom: 24px; overflow-x: auto; }
.hk-nav-tab { text-decoration: none; color: var(--hk-text-light); font-weight: 600; font-size: 14px; padding: 10px 20px; border-radius: 100px; background: transparent; transition: var(--hk-transition); white-space: nowrap; }
.hk-nav-tab:hover { background: var(--hk-border); color: var(--hk-dark); }
.hk-nav-tab.active { background: var(--hk-primary-light); color: var(--hk-primary); font-weight: 700; }

.hk-tabs-nav { border-bottom: 1px solid var(--hk-border); margin-bottom: 30px; display: flex; gap: 32px; overflow-x: auto; }
.hk-tab-btn { background: transparent; border: none; border-bottom: 2px solid transparent; color: var(--hk-text-light); padding: 0 0 12px 0; cursor: pointer; font-weight: 600; font-size: 15px; transition: var(--hk-transition); margin-bottom: -1px; white-space: nowrap; }
.hk-tab-btn:hover { color: var(--hk-dark); }
.hk-tab-btn.active { color: var(--hk-primary); border-bottom-color: var(--hk-primary); }

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

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

/* ==========================================================================
   Forms & Inputs
   ========================================================================== */
.hk-grid-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }
.hk-form-group-field, .hk-form-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.hk-form-group-field label, .hk-form-group label { font-weight: 600; font-size: 13px; color: var(--hk-dark-light); }

.hk-input, .hk-select {
    width: 100%; height: 44px; padding: 0 16px; border: 1px solid var(--hk-border);
    border-radius: var(--hk-radius-sm); font-size: 14px; transition: var(--hk-transition);
    background: #ffffff; color: var(--hk-dark); box-shadow: var(--hk-shadow-sm);
}

textarea.hk-input { height: auto; padding: 12px 16px; resize: vertical; min-height: 80px; }

.hk-input:focus, .hk-select:focus { border-color: var(--hk-primary); outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }
.hk-input:disabled, .hk-select:disabled { background: var(--hk-bg); color: var(--hk-text-muted); cursor: not-allowed; }

/* Input Time Special Tweaks */
input[type="time"].hk-input {
    font-family: monospace !important;
    font-size: 16px;
    letter-spacing: 1px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.hk-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 44px; padding: 0 24px; border: none; border-radius: var(--hk-radius-sm);
    font-weight: 600; font-size: 14px; cursor: pointer; transition: var(--hk-transition); text-decoration: none;
}

.hk-btn-primary { background: var(--hk-primary); color: #ffffff; box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2); }
.hk-btn-primary:hover { background: var(--hk-primary-hover); transform: translateY(-1px); box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3); }

.hk-btn-success { background: var(--hk-success); color: #ffffff; box-shadow: 0 2px 4px rgba(5, 150, 105, 0.2); }
.hk-btn-success:hover { background: var(--hk-success-hover); transform: translateY(-1px); box-shadow: 0 4px 6px rgba(5, 150, 105, 0.3); }

.hk-btn-danger { background: var(--hk-danger-light); color: var(--hk-danger); }
.hk-btn-danger:hover { background: var(--hk-danger); color: #ffffff; }

.hk-app-bar-logout { color: var(--hk-text-light); font-weight: 600; font-size: 13px; text-decoration: none; transition: var(--hk-transition); padding: 8px 16px; border-radius: var(--hk-radius-sm); }
.hk-app-bar-logout:hover { background: var(--hk-danger-light); color: var(--hk-danger); }

/* ==========================================================================
   Data Tables & Sorting Visuals (Asc/Desc)
   ========================================================================== */
.hk-table { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 8px; }
.hk-table th {
    background: #ffffff; color: var(--hk-text-light); font-weight: 600; font-size: 12px;
    text-transform: uppercase; letter-spacing: 0.5px; padding: 16px; border-bottom: 1px solid var(--hk-border);
    text-align: right; position: relative; transition: background 0.2s; user-select: none;
}
.hk-table th:hover { background-color: rgba(37, 99, 235, 0.05); }
.hk-table th.sort-asc::after { content: ' \2191'; color: var(--hk-primary); font-weight: bold; font-size: 14px; margin-right: 5px; }
.hk-table th.sort-desc::after { content: ' \2193'; color: var(--hk-primary); font-weight: bold; font-size: 14px; margin-right: 5px; }
.hk-table td { padding: 16px; font-size: 13.5px; border-bottom: 1px solid var(--hk-bg); background: #ffffff; color: var(--hk-text); vertical-align: middle; }
.hk-table tbody tr { transition: var(--hk-transition); }
.hk-table tbody tr:hover td { background: var(--hk-primary-light); }
.hk-table tfoot td { background: var(--hk-bg); border-top: 1px solid var(--hk-border); font-weight: bold; color: var(--hk-dark); }

.hk-parent-badge {
    background:#e2e8f0; color:#334155; padding:4px 10px; border-radius:8px; font-size:12px; font-weight:bold;
}

/* ==========================================================================
   شاخه‌های فعالیت‌های درختی
   ========================================================================== */
.hk-activity-cell { min-width: 320px; vertical-align: middle; }
.hk-activity-container { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.hk-select-step { display: inline-flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 120px; max-width: 220px; }
.hk-step-arrow { color: var(--hk-primary); font-weight: 800; font-size: 16px; user-select: none; padding: 0 2px; flex-shrink: 0; animation: pulseArrow 1.5s infinite ease-in-out; }

@keyframes pulseArrow { 0%, 100% { transform: translateX(0); opacity: 0.8; } 50% { transform: translateX(-3px); opacity: 1; } }

.hk-table .hk-input, .hk-table .hk-select { height: 38px; padding: 0 10px; font-size: 13px; border-radius: 8px; }

/* ==========================================================================
   Progress Bar Components (For Dashboard)
   ========================================================================== */
.hk-progress-bg {
    width: 100%;
    background-color: var(--hk-border);
    border-radius: 9999px;
    height: 8px;
    overflow: hidden;
}

.hk-progress-bar {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.5s ease;
}

/* ==========================================================================
   Summary Widgets
   ========================================================================== */
.hk-header-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; margin-bottom: 32px; }
.hk-summary-card { background: var(--hk-card); padding: 24px; border-radius: var(--hk-radius-lg); box-shadow: var(--hk-shadow-sm); border: 1px solid var(--hk-border); display: flex; align-items: center; gap: 20px; transition: var(--hk-transition); }
.hk-summary-card:hover { box-shadow: var(--hk-shadow); }
.hk-summary-icon { font-size: 24px; background: var(--hk-bg); width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.hk-summary-info h3 { margin: 0; font-size: 13px; color: var(--hk-text-light); font-weight: 600; }
.hk-summary-info strong { font-size: 24px; color: var(--hk-dark); font-weight: 800; display: block; margin-top: 4px; }

/* ==========================================================================
   Alerts & Notifications
   ========================================================================== */
.hk-alert { padding: 16px 20px; border-radius: var(--hk-radius-sm); margin-bottom: 24px; display: none; font-weight: 600; font-size: 14px; align-items: center; gap: 12px; }
.hk-alert-success { background: var(--hk-success-light); color: var(--hk-success-hover); border: 1px solid rgba(16, 185, 129, 0.2); }
.hk-alert-error { background: var(--hk-danger-light); color: var(--hk-danger-hover); border: 1px solid rgba(239, 68, 68, 0.2); }

/* ==========================================================================
   Modals
   ========================================================================== */
.hk-modal { display: none; position: fixed; z-index: 99999; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(15, 23, 42, 0.4); backdrop-filter: blur(4px); align-items: center; justify-content: center; }
.hk-modal-content { background-color: #ffffff; margin: auto; padding: 32px; border-radius: var(--hk-radius-lg); box-shadow: var(--hk-shadow-float); width: 100%; max-width: 600px; position: relative; animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes modalSlideIn { from { opacity: 0; transform: translateY(20px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.hk-modal-close { position: absolute; top: 24px; left: 24px; font-size: 24px; color: var(--hk-text-light); cursor: pointer; transition: var(--hk-transition); }
.hk-modal-close:hover { color: var(--hk-danger); }

/* ==========================================================================
   Pagination & Action Bars
   ========================================================================== */
.hk-action-bar-personnel { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--hk-border); }
.hk-pagination-wrapper { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 15px; margin-top: 24px; padding: 16px; background: #ffffff; border-radius: var(--hk-radius-sm); border: 1px solid var(--hk-border); }

@media (max-width: 768px) { .hk-pagination-wrapper { justify-content: center; flex-direction: column; text-align: center; } }
.hk-pagination-buttons { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; direction: ltr; }
.hk-page-btn { padding: 6px 12px; border: 1px solid var(--hk-border); background: #ffffff; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--hk-text); transition: var(--hk-transition); min-width: 36px; display: flex; justify-content: center; }
.hk-page-btn:hover:not(:disabled) { background: var(--hk-bg); }
.hk-page-btn.active { background: var(--hk-primary); color: #ffffff; border-color: var(--hk-primary); }
.hk-page-btn:disabled { opacity: 0.5; cursor: not-allowed; background: var(--hk-bg); }
.hk-page-ellipsis { color: var(--hk-text-light); font-weight: 800; letter-spacing: 2px; padding: 0 4px; user-select: none; }
.hk-toggle-label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--hk-dark-light); }
.hk-loading { opacity: 0.6; pointer-events: none; position: relative; }

/* ==========================================================================
   Responsive Table for Mobile
   ========================================================================== */
@media (max-width: 992px) {
    .hk-personnel-card, .hk-wrapper { margin: 0 16px 24px 16px; padding: 20px; }
    .hk-personnel-app-bar { padding: 16px 20px; }
    .hk-table thead { display: none; }
    .hk-table, .hk-table tbody, .hk-table tr, .hk-table td { display: block; width: 100%; }
    .hk-table tr { margin-bottom: 16px; border: 1px solid var(--hk-border); border-radius: var(--hk-radius-sm); padding: 16px; background: #ffffff; }
    .hk-table td { text-align: right; padding: 8px 0; border: none; border-bottom: 1px solid var(--hk-bg); display: flex; justify-content: space-between; align-items: center; }
    .hk-table td.hk-activity-cell { flex-direction: column; align-items: stretch; gap: 8px; }
    .hk-activity-container { flex-direction: column; align-items: stretch; }
    .hk-select-step { max-width: 100%; width: 100%; justify-content: space-between; }
    .hk-table td:last-child { border-bottom: none; padding-bottom: 0; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--hk-border); justify-content: flex-end; }
    .hk-table td::before { content: attr(data-label); font-weight: 600; color: var(--hk-text-light); font-size: 12px; }
}

/* ==========================================================================
   Login Page Styling (WP Login)
   ========================================================================== */
body.login * { box-sizing: border-box !important; }
body.login { background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%); font-family: 'Vazir', sans-serif !important; }
body.login h1.wp-login-logo, body.login #nav, body.login #backtoblog, body.login .language-switcher { display: none !important; }
body.login #login { width: 100% !important; max-width: 420px !important; padding: 15px !important; margin: 40px auto !important; box-sizing: border-box !important; }

#loginform, #hk-login-container { background: var(--hk-card); padding: 40px; border-radius: var(--hk-radius-lg); box-shadow: var(--hk-shadow); border: 1px solid rgba(255, 255, 255, 0.5); margin-bottom: 0; width: 100% !important; box-sizing: border-box !important; animation: fadeIn 0.5s ease-out; }
#hk-login-container { padding: 30px; }

body.login .input { width: 100%; height: 52px; padding: 0 20px; border: 2px solid #e2e8f0; border-radius: var(--hk-radius-sm); background: #f8fafc; transition: all 0.3s ease; font-size: 16px; margin-bottom: 20px; box-sizing: border-box !important; }
body.login .input:focus { border-color: var(--hk-primary); background: #ffffff; box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1); outline: none; }
body.login .button-primary { width: 100%; height: 52px; background: var(--hk-primary) !important; border-radius: var(--hk-radius-sm) !important; font-weight: 800 !important; font-size: 16px !important; transition: transform 0.2s, background 0.3s !important; box-sizing: border-box !important; }
body.login .button-primary:hover { transform: translateY(-2px); background: var(--hk-primary-hover) !important; }

.hk-toggle-login-btn { display: block; text-align: center; margin-top: 15px; font-size: 14px; color: #64748b; text-decoration: none; font-weight: 500; padding: 12px; border-radius: var(--hk-radius-sm); background: rgba(0,0,0,0.02); }
.hk-toggle-login-btn:hover { background: rgba(79, 70, 229, 0.05); color: var(--hk-primary); }

@media (max-width: 480px) { .forgetmenot { display: none !important; } #loginform, #hk-login-container { padding: 20px !important; } }

.hk-login-wrapper h2 { font-size: 1.5rem; color: #0f172a; margin-bottom: 25px; text-align: center; }
.hk-form-group { margin-bottom: 20px; text-align: right; }
.hk-form-group label { display: block; margin-bottom: 8px; font-size: 0.9rem; font-weight: 600; color: #475569; }
.hk-form-group input { width: 100%; padding: 12px; border: 1px solid #e2e8f0; border-radius: 10px; font-size: 1rem; text-align: center; box-sizing: border-box; transition: all 0.3s; }
.hk-form-group input:focus { border-color: #3b82f6; outline: none; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }
.hk-btn-login { width: 100%; padding: 14px; border: none; border-radius: 10px; background: #3b82f6; color: white; font-weight: bold; cursor: pointer; transition: background 0.3s; }
.hk-btn-login:hover { background: #2563eb; }
.hk-btn-verify { background: #10b981 !important; }

@media (max-width: 480px) { table th { pointer-events: none; cursor: default !important; } }

/* ==========================================================================
   Excel-like First Column Freeze (Locking)
   ========================================================================== */
@media (min-width: 992px) {
    .hk-table th:first-child, .hk-table td:first-child { position: sticky; right: 0; background: #ffffff; z-index: 10; border-left: 2px solid var(--hk-primary-light); box-shadow: -2px 0 5px rgba(0,0,0,0.02); }
    .hk-table thead th:first-child { z-index: 11; }
    .hk-table tbody tr:hover td:first-child { background: var(--hk-primary-light); }
}