/* =========================================================
   کامپوننت‌های قابل استفاده مجدد
   Button / Badge / Input / Chip / Card / Modal / Stars ...
   ========================================================= */

/* ---------- Button ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: .72rem 1.35rem;
    font-family: inherit;
    font-size: .95rem;
    font-weight: 700;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
    transition: transform .15s ease, background-color .2s ease, border-color .2s ease, box-shadow .2s ease, color .2s ease;
    white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 20px -10px rgba(249, 115, 22, .8);
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
    background: var(--secondary-soft);
    color: var(--secondary-dark);
}
.btn-secondary:hover { background: var(--secondary-soft-hover); }

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

.btn-ghost {
    background: transparent;
    color: var(--text);
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-light {
    background: #fff;
    color: var(--primary);
}
.btn-light:hover { background: var(--primary-soft); }

.btn-danger {
    background: #ef4444;
    color: #fff;
}
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: .5rem .95rem; font-size: .86rem; }
.btn-lg { padding: .95rem 1.9rem; font-size: 1.02rem; }
.btn-block { width: 100%; }

.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---------- Icon button ---------- */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: .2s ease;
    flex: 0 0 auto;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.icon-btn.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Badge ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .28rem .6rem;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
}
.badge-success { background: rgba(22, 163, 74, .12); color: #15803d; }
.badge-danger  { background: rgba(220, 38, 38, .12); color: #b91c1c; }
.badge-muted   { background: var(--surface-2); color: var(--muted); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-accent  { background: rgba(245, 158, 11, .15); color: #b45309; }
.badge-outline { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.badge-lg { padding: .4rem .85rem; font-size: .82rem; }

/* ---------- Chip ---------- */
.chip-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin: 0;
    padding: 0;
}
.chip {
    display: inline-flex;
    align-items: center;
    padding: .28rem .68rem;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid transparent;
    color: var(--muted);
    font-size: .76rem;
    font-weight: 600;
}
.chip-primary { background: var(--primary-soft); color: var(--primary); border-color: rgba(249, 115, 22, .2); }
.chip-muted { background: transparent; border-color: var(--border); }
.chip-click { cursor: pointer; transition: .18s ease; }
.chip-click:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Form ---------- */
.field { margin-bottom: 1.1rem; }

.label {
    display: block;
    margin-bottom: .45rem;
    font-size: .87rem;
    font-weight: 700;
    color: var(--text);
}
.label .req { color: #ef4444; margin-inline-start: .15rem; }
.label-hint { font-weight: 500; color: var(--muted); font-size: .78rem; }

.input-wrap { position: relative; display: flex; align-items: center; }

.input,
.select,
.textarea {
    width: 100%;
    padding: .78rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: .93rem;
    line-height: 1.6;
    transition: border-color .18s ease, box-shadow .18s ease;
    appearance: none;
}
.input::placeholder,
.textarea::placeholder { color: #a8a29e; }

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.textarea { min-height: 128px; resize: vertical; }

.select {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left .9rem center;
    padding-inline-start: 2.6rem;
}

.input-with-icon { padding-inline-start: 2.7rem; }
.input-icon {
    position: absolute;
    inset-inline-start: .95rem;
    color: var(--muted);
    pointer-events: none;
}
.input-wrap .input:focus + .input-icon,
.input-wrap:focus-within .input-icon { color: var(--primary); }

.input-suffix {
    position: absolute;
    inset-inline-end: .9rem;
    color: var(--muted);
    font-size: .82rem;
    pointer-events: none;
}

.field-error {
    display: none;
    margin-top: .35rem;
    font-size: .79rem;
    font-weight: 600;
    color: #dc2626;
}
.field.has-error .input,
.field.has-error .select,
.field.has-error .textarea { border-color: #dc2626; box-shadow: 0 0 0 4px rgba(220, 38, 38, .1); }
.field.has-error .field-error { display: block; }

.check {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-size: .87rem;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}
.check input { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }

/* ---------- Card ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.3rem;
    border-bottom: 1px dashed var(--border);
}
.card-header h3 { margin: 0; font-size: 1rem; }
.card-body { padding: 1.3rem; }

/* ---------- Stars ---------- */
.stars { display: inline-flex; gap: 1px; vertical-align: middle; }
.star { fill: #e7e5e4; }
.star.filled { fill: #f59e0b; }
.star.half { fill: url(#none); fill: #f59e0b; opacity: .55; }
.star-solid { color: #f59e0b; fill: #f59e0b; }

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(28, 25, 23, .55);
    backdrop-filter: blur(3px);
}
.modal-backdrop.is-open { display: flex; }

.modal {
    width: min(520px, 100%);
    max-height: 90vh;
    overflow: auto;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .45);
    animation: modalIn .22s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(14px) scale(.98); }
    to   { opacity: 1; transform: none; }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 1.05rem; }
.modal-body { padding: 1.4rem; }
.modal-actions {
    display: flex;
    gap: .7rem;
    justify-content: flex-start;
    padding: 0 1.4rem 1.4rem;
}

/* ---------- Toast ---------- */
.toast-stack {
    position: fixed;
    bottom: 1.2rem;
    inset-inline-start: 1.2rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}
.toast {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .8rem 1.1rem;
    border-radius: 12px;
    background: #17120d;
    color: #fff;
    font-size: .87rem;
    font-weight: 600;
    box-shadow: 0 18px 35px -18px rgba(0, 0, 0, .8);
    animation: toastIn .25s ease;
}
.toast.is-out { opacity: 0; transform: translateY(8px); transition: .25s ease; }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

/* ---------- Section header ---------- */
.section { padding: 4.2rem 0; }
.section-alt { background: var(--surface); border-block: 1px solid var(--border); }

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2.2rem;
}
.section-head h2 {
    margin: 0 0 .4rem;
    font-size: clamp(1.35rem, 2.6vw, 1.85rem);
    line-height: 1.5;
}
.section-head p { margin: 0; color: var(--muted); font-size: .95rem; }
.section-head .link-more {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--primary);
    font-weight: 700;
    font-size: .9rem;
    text-decoration: none;
    white-space: nowrap;
}
.section-head .link-more:hover { text-decoration: underline; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: .7rem;
    padding: .35rem .8rem;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: .78rem;
    font-weight: 700;
}

/* ---------- Empty / loading ---------- */
.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--muted);
}
.empty-state .icon { margin-bottom: .7rem; color: var(--border); }
.empty-state h4 { margin: 0 0 .3rem; color: var(--text); }

/* ---------- Divider ---------- */
.divider { height: 1px; background: var(--border); border: 0; margin: 1.5rem 0; }
.divider-dashed { border-top: 1px dashed var(--border); background: none; }

/* ---------- Alert ---------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    padding: .9rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    line-height: 1.9;
}
.alert-info    { background: var(--primary-soft); color: var(--primary-dark); }
.alert-success { background: rgba(22, 163, 74, .1); color: #15803d; }
.alert-warning { background: rgba(245, 158, 11, .14); color: #b45309; }
.alert .icon { flex: 0 0 auto; margin-top: .2rem; }
