@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

:root {
    --bg: #f6f5f2;
    --surface: #ffffff;
    --surface-soft: #fbfaf8;
    --border: #e4e1da;
    --border-strong: #d3cfc4;
    --text: #262420;
    --text-soft: #6b675e;
    --text-faint: #9a9587;

    --accent: #2f6f5e;
    --accent-dark: #234f43;
    --accent-soft: #e6efe9;

    --danger: #ac3b3b;
    --danger-soft: #f6e7e7;
    --warning: #a2721f;
    --warning-soft: #f6eedd;

    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(30, 27, 20, 0.04), 0 6px 16px -8px rgba(30, 27, 20, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Vazirmatn', Tahoma, 'Segoe UI', Arial, sans-serif;
    direction: rtl;
    line-height: 1.7;
    font-size: 15px;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 17px;
    color: var(--text);
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    flex-shrink: 0;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-soft);
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.page-head h1 {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
}

.page-head p {
    margin: 0;
    color: var(--text-soft);
    font-size: 14px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .05s ease;
}

.btn:hover {
    background: var(--surface-soft);
    border-color: var(--text-faint);
}

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

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
}

.btn-danger {
    color: var(--danger);
    border-color: #e3bdbd;
    background: var(--danger-soft);
}

.btn-danger:hover {
    background: #f0d3d3;
    border-color: var(--danger);
}

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel-pad {
    padding: 24px;
}

.search-box {
    position: relative;
    max-width: 340px;
    width: 100%;
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    text-align: right;
    font-weight: 600;
    color: var(--text-soft);
    font-size: 12.5px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--surface-soft);
}

.cell-plugin {
    display: flex;
    align-items: center;
    gap: 10px;
}

.plugin-icon,
.plugin-icon-fallback {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    flex-shrink: 0;
    object-fit: cover;
    border: 1px solid var(--border);
}

.plugin-icon-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-weight: 700;
    font-size: 14px;
}

.cell-plugin strong {
    display: block;
    font-weight: 600;
}

.cell-plugin span {
    color: var(--text-faint);
    font-size: 12.5px;
}

.row-actions {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    justify-content: flex-start;
}

.row-actions .btn {
    flex: none;
    white-space: nowrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12.5px;
    font-weight: 600;
}

.badge-active {
    background: var(--accent-soft);
    color: var(--accent-dark);
}

.badge-inactive {
    background: #efece5;
    color: var(--text-faint);
}

.badge-version {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    color: var(--text-soft);
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.badge-request {
    background: var(--warning-soft);
    color: var(--warning);
    white-space: nowrap;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form-grid .full {
    grid-column: 1 / -1;
}

@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.field label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.field .hint {
    display: block;
    font-size: 12px;
    color: var(--text-faint);
    margin-top: 5px;
}

.field input[type=text],
.field input[type=url],
.field input[type=date],
.field input[type=password],
.field select,
.field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
}

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

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

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--accent-soft);
    color: var(--accent-dark);
    border-color: #c7ddd2;
}

.alert-error {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: #e3bdbd;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-faint);
}

.empty-state p {
    margin: 10px 0 0;
}

/* ---------- Modal ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(30, 27, 20, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}

.modal-overlay[hidden] {
    display: none;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 12px 40px -8px rgba(30, 27, 20, 0.35);
    width: 100%;
    max-width: 440px;
    padding: 24px;
}

.modal h2 {
    margin: 0 0 18px;
    font-size: 16px;
}

.modal .field textarea {
    min-height: 110px;
}

.upload-progress-wrap {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-progress-track {
    flex: 1;
    max-width: 140px;
    height: 6px;
    background: var(--border);
    border-radius: 100px;
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 100px;
    transition: width .15s ease;
}

.upload-progress-text {
    font-size: 12px;
    color: var(--text-faint);
    white-space: nowrap;
}

.modal-lg {
    max-width: 560px;
}

.history-list {
    max-height: 55vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.history-row {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.history-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.history-row-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 13px;
}

.history-row-changes {
    font-size: 13.5px;
    color: var(--text-soft);
}

.changelog-text {
    font-size: 13.5px;
    color: var(--text-soft);
}

.history-row-changes p,
.changelog-text p {
    margin: 0 0 8px;
}

.history-row-changes p:last-child,
.changelog-text p:last-child {
    margin-bottom: 0;
}

.changelog-list {
    margin: 0 0 8px;
    padding-inline-start: 20px;
}

.changelog-list:last-child {
    margin-bottom: 0;
}

.changelog-list li {
    margin-bottom: 4px;
}

.changelog-list li:last-child {
    margin-bottom: 0;
}

.history-row-changes strong,
.changelog-text strong {
    color: var(--text);
    font-weight: 700;
}

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 360px;
}

.login-card .brand {
    justify-content: center;
    margin-bottom: 22px;
    font-size: 18px;
}

.login-card h1 {
    font-size: 17px;
    text-align: center;
    margin: 0 0 24px;
    color: var(--text-soft);
    font-weight: 500;
}

.field + .field {
    margin-top: 16px;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 22px;
}

.tabs {
    display: flex;
    gap: 6px;
}

.tab {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-soft);
    border: 1px solid transparent;
}

.tab:hover {
    background: var(--surface-soft);
}

.tab-active {
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-weight: 600;
}

.plugin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.plugin-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.plugin-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow);
}

.plugin-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.plugin-card-head .plugin-icon,
.plugin-card-head .plugin-icon-fallback {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    font-size: 16px;
}

.plugin-card-head h3 {
    margin: 0;
    font-size: 15.5px;
    font-weight: 700;
}

.plugin-card-head .cat {
    font-size: 12px;
    color: var(--text-faint);
    margin-top: 2px;
}

.plugin-card p.desc {
    margin: 0;
    font-size: 13.5px;
    color: var(--text-soft);
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.plugin-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12.5px;
    color: var(--text-faint);
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.plugin-card-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12.5px;
    color: var(--text-faint);
    flex-grow: 1;
    justify-content: center;
    padding: 10px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.plugin-card-info .info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.plugin-card-foot {
    display: flex;
    gap: 8px;
}

.text-faint {
    color: var(--text-faint);
}

.mt-0 { margin-top: 0; }

footer.site-footer {
    text-align: center;
    padding: 24px;
    color: var(--text-faint);
    font-size: 12.5px;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
    .topbar-inner {
        flex-wrap: wrap;
        padding: 14px 16px;
    }

    .topbar nav {
        flex-wrap: wrap;
        width: 100%;
        gap: 8px;
    }

    .container {
        padding: 20px 16px 48px;
    }

    .page-head {
        align-items: flex-start;
    }
}
