/* ═══════════════════════════════════════════════════════
   components.css — کامپوننت‌های رابط کاربری
   ═══════════════════════════════════════════════════════ */

/* ─── دکمه‌ها ─────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: .4rem; padding: .5rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: .875rem; font-weight: 500;
    cursor: pointer; border: none;
    transition: var(--transition);
    white-space: nowrap; line-height: 1.5;
    font-family: var(--font);
    text-decoration: none;
}
.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.btn:disabled,
.btn[disabled] { opacity: .6; cursor: not-allowed; pointer-events: none; }

.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); }

.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-3); border-color: var(--border-dark); }

.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.9); }

.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.9); }

.btn-warning   { background: var(--warning); color: #fff; }
.btn-warning:hover { filter: brightness(.9); }

.btn-ghost {
    background: transparent; color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-ghost:hover { background: var(--primary-light); }

.btn-sm   { padding: .35rem .875rem; font-size: .8rem; }
.btn-lg   { padding: .75rem 1.75rem; font-size: 1rem; border-radius: var(--radius); }
.btn-block { width: 100%; }

.btn-icon {
    width: 2.25rem; height: 2.25rem;
    padding: 0; border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface); color: var(--text-muted);
    font-size: .9rem;
}
.btn-icon:hover { background: var(--surface-3); color: var(--text); }

/* ─── فرم‌ها ──────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

.form-label {
    display: block; font-size: .875rem;
    font-weight: 500; color: var(--text);
    margin-bottom: .375rem;
}
.form-label .required { color: var(--danger); margin-right: 2px; }

.form-control {
    width: 100%; padding: .5625rem .875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text);
    font-size: .9rem; transition: var(--transition);
    appearance: none;
    font-family: var(--font);
    direction: rtl; text-align: right;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(29,78,216,.1);
}
.form-control::placeholder { color: var(--text-light); font-size: .85rem; }
.form-control.is-invalid   { border-color: var(--danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(185,28,28,.1); }

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

select.form-control {
    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='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left .875rem center;
    padding-left: 2.25rem;
}

.form-error {
    font-size: .8rem; color: var(--danger);
    margin-top: .25rem;
    display: flex; align-items: center; gap: .25rem;
}
.form-hint {
    font-size: .8rem; color: var(--text-muted);
    margin-top: .25rem;
}

.input-group { display: flex; align-items: stretch; }
.input-group .form-control {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    flex: 1;
}
.input-group .btn {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    flex-shrink: 0;
}

.form-check {
    display: flex; align-items: center; gap: .5rem;
    cursor: pointer; font-size: .875rem;
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 1rem; height: 1rem;
    accent-color: var(--primary); cursor: pointer;
    flex-shrink: 0;
}

/* ─── کارت‌ها ─────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}
.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    background: var(--surface);
}
.card-header h5,
.card-header h6 { font-weight: 600; color: var(--text); margin: 0; }
.card-body   { padding: 1.25rem; }
.card-footer {
    padding: .875rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

/* کارت آمار */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex; align-items: flex-start; gap: 1rem;
    box-shadow: var(--shadow-xs);
    transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.stat-card-icon {
    width: 3rem; height: 3rem;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.375rem; flex-shrink: 0;
}
.stat-card-icon.blue   { background: var(--primary-light);   color: var(--primary); }
.stat-card-icon.green  { background: var(--success-light);   color: var(--success); }
.stat-card-icon.yellow { background: var(--warning-light);   color: var(--warning); }
.stat-card-icon.red    { background: var(--danger-light);    color: var(--danger); }
.stat-card-icon.purple { background: var(--secondary-light); color: var(--secondary); }

.stat-card-value { font-size: 1.625rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.stat-card-label { font-size: .8rem; color: var(--text-muted); margin-top: .2rem; }

/* ─── جداول ───────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.table thead { background: var(--surface-2); }
.table thead th {
    padding: .75rem 1rem;
    font-size: .8rem; font-weight: 600;
    color: var(--text-muted);
    text-align: right;
    border-bottom: 1px solid var(--border);
}
.table tbody td {
    padding: .875rem 1rem;
    font-size: .875rem; color: var(--text);
    border-bottom: 1px solid var(--border);
    text-align: right; vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover          { background: var(--surface-2); }
.table-actions {
    display: flex; gap: .375rem; justify-content: flex-end;
}

/* ─── بج‌ها ────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center;
    padding: .2rem .625rem;
    border-radius: var(--radius-full);
    font-size: .75rem; font-weight: 500;
    white-space: nowrap;
}
.badge-primary   { background: var(--primary-light);   color: var(--primary-dark); }
.badge-success   { background: var(--success-light);   color: var(--success); }
.badge-warning   { background: var(--warning-light);   color: var(--warning); }
.badge-danger    { background: var(--danger-light);    color: var(--danger); }
.badge-info      { background: var(--info-light);      color: var(--info); }
.badge-secondary { background: var(--secondary-light); color: var(--secondary); }
.badge-gray      { background: var(--surface-3);       color: var(--text-muted); }

/* وضعیت مقاله */
.badge-draft        { background: #f1f5f9; color: #64748b; }
.badge-submitted    { background: var(--info-light);    color: var(--info); }
.badge-under-review { background: var(--warning-light); color: var(--warning); }
.badge-revision     { background: #fef3c7; color: #92400e; }
.badge-accepted     { background: var(--success-light); color: var(--success); }
.badge-rejected     { background: var(--danger-light);  color: var(--danger); }

/* ─── هشدارها ─────────────────────────────────────────── */
.alert {
    padding: .875rem 1rem;
    border-radius: var(--radius-sm);
    display: flex; align-items: flex-start; gap: .625rem;
    font-size: .875rem; border: 1px solid transparent;
    margin-bottom: 1rem;
}
.alert-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: .05rem; }

.alert-success { background: var(--success-light); color: var(--success); border-color: #a7f3d0; }
.alert-error   { background: var(--danger-light);  color: var(--danger);  border-color: #fca5a5; }
.alert-warning { background: var(--warning-light); color: var(--warning); border-color: #fde68a; }
.alert-info    { background: var(--info-light);    color: var(--info);    border-color: #bae6fd; }

.alert-dismissible { position: relative; padding-left: 2rem; }
.alert-close {
    position: absolute; left: .75rem; top: .75rem;
    background: none; border: none; cursor: pointer;
    color: inherit; opacity: .7; font-size: 1.1rem; line-height: 1;
}
.alert-close:hover { opacity: 1; }

/* ─── مودال ────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1000;
    display: none; align-items: center; justify-content: center;
    backdrop-filter: blur(2px);
}
.modal-overlay.show { display: flex; }

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%; max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn .2s ease;
}
@keyframes modalIn {
    from { transform: scale(.95); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}
.modal-header {
    padding: 1.125rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h5 { font-weight: 600; font-size: 1rem; margin: 0; }
.modal-body      { padding: 1.25rem; }
.modal-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex; gap: .5rem; justify-content: flex-end;
}
.modal-close {
    background: none; border: none;
    font-size: 1.25rem; cursor: pointer;
    color: var(--text-muted); line-height: 1;
    padding: .25rem;
}
.modal-close:hover { color: var(--danger); }

/* ─── صفحه‌بندی ────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; margin-top: 1rem; }

.page-item {
    min-width: 2.25rem; height: 2.25rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    font-size: .875rem; cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface); color: var(--text);
    transition: var(--transition); text-decoration: none;
    padding: 0 .5rem;
}
.page-item:hover    { background: var(--surface-3); }
.page-item.active   { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-item.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ─── تایم‌لاین (رهگیری مقاله) ────────────────────────── */
.timeline { position: relative; padding-right: 1.5rem; }
.timeline::before {
    content: '';
    position: absolute; right: .6rem; top: 0; bottom: 0;
    width: 2px; background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 1.5rem; padding-right: 2rem; }
.timeline-dot {
    position: absolute; right: -.45rem; top: .25rem;
    width: 1rem; height: 1rem;
    border-radius: 50%;
    background: var(--border);
    border: 2px solid var(--surface);
    box-shadow: var(--shadow-xs);
}
.timeline-item.done   .timeline-dot { background: var(--success); }
.timeline-item.active .timeline-dot {
    background: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.timeline-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .75rem 1rem;
}
.timeline-title { font-weight: 600; font-size: .875rem; color: var(--text); }
.timeline-date  { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; }
.timeline-note  {
    font-size: .83rem; color: var(--text-muted);
    margin-top: .375rem; padding-top: .375rem;
    border-top: 1px solid var(--border);
}

/* ─── نوار پیشرفت مراحل ────────────────────────────────── */
.steps { display: flex; align-items: center; margin-bottom: 2rem; }
.step  { display: flex; align-items: center; flex: 1; flex-direction: column; position: relative; }
.step:last-child { flex: 0; }

.step-circle {
    width: 2rem; height: 2rem;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 600;
    border: 2px solid var(--border);
    background: var(--surface); color: var(--text-muted);
    flex-shrink: 0; transition: var(--transition);
}
.step.active .step-circle { border-color: var(--primary); background: var(--primary); color: #fff; }
.step.done   .step-circle { border-color: var(--success); background: var(--success); color: #fff; }

.step-label {
    font-size: .78rem; color: var(--text-muted);
    margin-top: .375rem; white-space: nowrap;
    text-align: center;
}
.step.active .step-label { color: var(--primary); font-weight: 500; }
.step.done   .step-label { color: var(--success); }

.step-line {
    flex: 1; height: 2px;
    background: var(--border);
    margin: 0 .5rem; margin-top: -1.25rem;
}
.step.done + .step .step-line,
.step.done .step-line { background: var(--success); }

/* ─── ناحیه آپلود ─────────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem; text-align: center;
    cursor: pointer; transition: var(--transition);
    background: var(--surface-2);
}
.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.upload-zone-icon  { font-size: 2.5rem; color: var(--text-light); margin-bottom: .75rem; }
.upload-zone-title { font-weight: 500; color: var(--text); margin-bottom: .375rem; }
.upload-zone-hint  { font-size: .8rem; color: var(--text-muted); }
.upload-zone-file  {
    margin-top: 1rem;
    display: none; align-items: center; gap: .5rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: .5rem .875rem;
    font-size: .875rem;
}
.upload-zone-file.show { display: flex; }

/* ─── نوار قدرت رمز عبور ───────────────────────────────── */
.password-strength-bar {
    height: 4px; border-radius: 2px;
    background: var(--border); margin-top: .375rem;
    overflow: hidden;
}
.password-strength-bar-inner {
    height: 100%; border-radius: 2px;
    transition: var(--transition);
    width: 0%;
}
.password-strength-label {
    font-size: .75rem; margin-top: .25rem; color: var(--text-muted);
}
.strength-weak   .password-strength-bar-inner { background: var(--danger);  width: 25%; }
.strength-fair   .password-strength-bar-inner { background: var(--warning); width: 50%; }
.strength-good   .password-strength-bar-inner { background: var(--info);    width: 75%; }
.strength-strong .password-strength-bar-inner { background: var(--success); width: 100%; }

/* ─── نشانگر بارگذاری ──────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 1rem; height: 1rem;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── کارت پرینت ───────────────────────────────────────── */
.print-card-preview {
    width: 340px; min-height: 200px;
    border: 2px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 1.5rem; margin: 0 auto;
    background: #fff; direction: rtl;
    box-shadow: var(--shadow-md);
}
.print-card-conf-name { font-size: .85rem; color: var(--text-muted); margin-bottom: .5rem; }
.print-card-name      { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.print-card-paper     { font-size: .8rem; color: var(--text-muted); margin: .5rem 0 1rem; }
.print-card-qr        { margin: auto; }
.print-card-footer    { font-size: .75rem; color: var(--text-light); margin-top: 1rem; text-align: center; }

/* ─── کارت سریع داشبورد ───────────────────────────────── */
.quick-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(160px,1fr));
    gap: 1rem;
}
.quick-action-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1rem;
    text-align: center;
    cursor: pointer; text-decoration: none;
    transition: var(--transition); color: var(--text);
}
.quick-action-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
    color: var(--primary);
}
.quick-action-icon {
    font-size: 1.75rem; margin-bottom: .5rem;
    display: block;
}
.quick-action-label { font-size: .875rem; font-weight: 500; }

/* ─── امتیازدهی ستاره ─────────────────────────────────── */
.rating-group { display: flex; gap: .25rem; flex-direction: row-reverse; justify-content: flex-end; }
.rating-group input[type="radio"] { display: none; }
.rating-group label {
    font-size: 1.5rem; cursor: pointer; color: var(--border-dark);
    transition: color .15s;
}
.rating-group input:checked ~ label,
.rating-group label:hover,
.rating-group label:hover ~ label { color: #f59e0b; }

/* ─── نوار اعلانات ────────────────────────────────────── */
.notice-item {
    display: flex; align-items: flex-start; gap: .75rem;
    padding: .75rem 0;
    border-bottom: 1px solid var(--border);
}
.notice-item:last-child { border-bottom: none; }
.notice-dot {
    width: .5rem; height: .5rem; border-radius: 50%;
    background: var(--primary); flex-shrink: 0; margin-top: .35rem;
}
.notice-title { font-size: .875rem; font-weight: 500; color: var(--text); }
.notice-time  { font-size: .75rem; color: var(--text-light); margin-top: .1rem; }
