@font-face {
    font-family: IRANSans;
    src: url("../../fonts/woff2/IRANSansWeb(FaNum).woff2") format("woff2"),
         url("../../fonts/woff/IRANSansWeb(FaNum).woff") format("woff");
    font-weight: 400;
}

@font-face {
    font-family: IRANSans;
    src: url("../../fonts/woff2/IRANSansWeb(FaNum)_Bold.woff2") format("woff2"),
         url("../../fonts/woff/IRANSansWeb(FaNum)_Bold.woff") format("woff");
    font-weight: 700;
}

:root {
    --gold: #cfad5f;
    --gold-dark: #a88334;
    --ink: #1f242b;
    --muted: #6c7480;
    --line: #e5e7eb;
    --bg: #f5f6f8;
    --white: #fff;
    --danger: #d64545;
    --success: #21825c;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: IRANSans, Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
}

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

.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #1f242b 0%, #3b3324 55%, #cfad5f 160%);
}

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

.login-box {
    width: min(480px, 100%);
    background: rgba(255, 255, 255, .98);
    border: 1px solid rgba(207, 173, 95, .35);
    border-radius: 8px;
    padding: 28px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .24);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 26px;
}

.brand-mark,
.avatar-box {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--gold);
    color: #111;
    font-weight: 700;
    border-radius: 8px;
}

.login-brand h1 {
    margin: 0 0 5px;
    font-size: 20px;
}

.login-brand p,
.muted-text,
.content-header p,
.field-help {
    margin: 0;
    color: var(--muted);
}

.login-hint {
    margin-top: 18px;
    padding: 12px;
    background: #fbf7ed;
    border: 1px solid rgba(207, 173, 95, .35);
    border-radius: 8px;
    color: #5b4a24;
    font-size: 12px;
}

.admin-wrapper {
    min-height: 100vh;
}

.main-header {
    position: fixed;
    z-index: 20;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    height: 62px;
    background: var(--white);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 24px rgba(24, 31, 42, .06);
}

.logo {
    width: 280px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    background: #1f242b;
    color: var(--white);
}

.logo-mini {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #111;
    background: var(--gold);
    font-weight: 700;
}

.logo-lg {
    font-weight: 700;
    font-size: 13px;
}

.top-navbar {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.sidebar-toggle {
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    background: var(--white);
    border-radius: 8px;
    cursor: pointer;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-name {
    color: var(--muted);
    font-size: 13px;
}

.main-sidebar {
    position: fixed;
    top: 62px;
    right: 0;
    bottom: 0;
    width: 280px;
    background: #252b33;
    color: #e9edf2;
    overflow-y: auto;
    transition: transform .2s ease;
}

.user-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.user-panel p {
    margin: 0 0 4px;
    font-weight: 700;
}

.user-panel span {
    color: #aab2bd;
    font-size: 12px;
}

.sidebar-menu {
    list-style: none;
    padding: 12px;
    margin: 0;
}

.sidebar-menu .header {
    padding: 12px 10px;
    color: var(--gold);
    font-size: 12px;
}

.sidebar-menu a {
    display: flex;
    padding: 12px 14px;
    border-radius: 8px;
    color: #d8dee7;
}

.sidebar-menu li.active a,
.sidebar-menu a:hover {
    background: rgba(207, 173, 95, .16);
    color: var(--white);
}

.content-wrapper {
    margin-right: 280px;
    padding: 88px 24px 30px;
}

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

.content-header h1 {
    margin: 0 0 6px;
    font-size: 22px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.small-box,
.panel-section {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(24, 31, 42, .05);
}

.small-box {
    padding: 20px;
    border-top: 3px solid var(--gold);
}

.small-box span {
    color: var(--muted);
}

.small-box strong {
    display: block;
    margin-top: 12px;
    font-size: 28px;
}

.small-box .small-stat-text {
    font-size: 16px;
    line-height: 1.7;
    direction: ltr;
    text-align: right;
}

.panel-section {
    padding: 20px;
    margin-bottom: 18px;
}

.section-title h2 {
    margin: 0 0 14px;
    font-size: 17px;
}

.form-grid,
.filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.filter-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
}

.field-wide {
    grid-column: 1 / -1;
}

.field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
}

.input-box-panel {
    width: 100%;
    height: 44px;
    border: 1px solid #d5d9df;
    background: #fff;
    color: var(--ink);
    border-radius: 8px;
    padding: 0 12px;
    font-family: IRANSans, Tahoma, Arial, sans-serif;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.input-box-panel:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(207, 173, 95, .16);
}

.input-box-panel:disabled {
    background: #f1f3f5;
    cursor: not-allowed;
}

.field-help {
    display: block;
    margin-top: 7px;
    font-size: 11px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 12px;
    background: #fbf7ed;
    border: 1px solid rgba(207, 173, 95, .35);
    border-radius: 8px;
    cursor: pointer;
}

.check-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--gold);
}

.form-actions,
.filter-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-family: IRANSans, Tahoma, Arial, sans-serif;
    cursor: pointer;
    font-size: 13px;
}

.btn-primary {
    background: var(--gold);
    color: #17130a;
    border-color: var(--gold);
    font-weight: 700;
}

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

.btn-soft {
    background: #f2f4f7;
    border-color: #e1e5ea;
    color: #303741;
}

.btn-gold-outline {
    background: #fff;
    border-color: var(--gold);
    color: #6e5620;
}

.btn-danger {
    background: #fff2f2;
    color: var(--danger);
    border-color: #ffd4d4;
}

.btn-mini {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
}

.btn-full {
    width: 100%;
    margin-top: 20px;
}

.final-link-box {
    margin-top: 18px;
    padding: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: #f7f8fa;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.final-link-box span {
    color: var(--muted);
}

.final-link-box a,
.short-link {
    color: #8a681f;
    font-weight: 700;
}

.responsive-table {
    width: 100%;
    overflow-x: auto;
}

.panel-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

.panel-table th,
.panel-table td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: right;
    vertical-align: middle;
    white-space: nowrap;
}

.panel-table th {
    background: #f8f9fb;
    font-size: 12px;
    color: #4d5560;
}

.panel-table tr:hover td {
    background: #fcfbf7;
}

.url-cell {
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 8px;
    padding: 0 10px;
    font-size: 12px;
    background: #f1f3f5;
    color: #57606b;
}

.status-badge.ok {
    background: #e9f8f2;
    color: var(--success);
}

.status-badge.off {
    background: #f7f0e1;
    color: #8a681f;
}

.table-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 12px;
}

.empty-row,
.loading-line {
    text-align: center !important;
    padding: 26px !important;
    color: var(--muted);
}

.paginationbk {
    list-style: none;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 16px 0 0;
    margin: 0;
}

.paginationbk button {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
}

.paginationbk .currentpagepaginationbk button,
.paginationbk button:hover {
    background: var(--gold);
    border-color: var(--gold);
    color: #111;
}

.panel-popup {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(12, 15, 20, .54);
}

.panel-popup.show {
    display: flex;
}

.popup-card {
    width: min(430px, 100%);
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 28px 70px rgba(0, 0, 0, .28);
    border-top: 5px solid var(--gold);
}

.popup-card.error {
    border-top-color: var(--danger);
}

.popup-card.success {
    border-top-color: var(--success);
}

.popup-card h3 {
    margin: 0 0 10px;
    font-size: 18px;
}

.popup-card p {
    margin: 0 0 18px;
    color: var(--muted);
    line-height: 1.9;
}

.redirect-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #f7f5ef;
}

.redirect-box {
    width: min(520px, 100%);
    padding: 34px;
    text-align: center;
    background: #fff;
    border-radius: 8px;
    border: 1px solid rgba(207, 173, 95, .35);
    box-shadow: 0 20px 50px rgba(24, 31, 42, .10);
}

.redirect-box h1 {
    margin: 16px 0 8px;
    font-size: 20px;
}

.redirect-box p {
    color: var(--muted);
    margin-bottom: 22px;
}

.redirect-countdown {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 22px;
    padding: 10px 14px;
    background: #fbf7ed;
    border: 1px solid rgba(207, 173, 95, .35);
    border-radius: 8px;
    color: var(--ink);
}

.redirect-countdown strong {
    min-width: 34px;
    font-size: 24px;
    color: #8a681f;
    direction: ltr;
}

.redirect-countdown span {
    color: var(--muted);
    font-size: 13px;
}

.loader-ring {
    width: 54px;
    height: 54px;
    display: inline-block;
    border: 5px solid #efe3c8;
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin .9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

body.sidebar-collapsed .main-sidebar {
    transform: translateX(280px);
}

body.sidebar-collapsed .content-wrapper {
    margin-right: 0;
}

@media (max-width: 980px) {
    .logo,
    .main-sidebar {
        width: 250px;
    }

    .content-wrapper {
        margin-right: 0;
        padding: 82px 14px 24px;
    }

    .main-sidebar {
        transform: translateX(250px);
    }

    body.sidebar-open .main-sidebar {
        transform: translateX(0);
    }

    .stats-grid,
    .form-grid,
    .filter-grid {
        grid-template-columns: 1fr;
    }

    .content-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .top-navbar {
        padding: 0 12px;
    }

    .admin-name {
        display: none;
    }
}
