@font-face {
    font-family: 'IRANYekanX';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('font/IRANYekanX-Regular.woff2') format('woff2');
}

@font-face {
    font-family: 'IRANYekanX';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('font/IRANYekanX-Bold.woff2') format('woff2');
}

@font-face {
    font-family: 'IRANYekanX';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('font/IRANYekanX-Black.woff2') format('woff2');
}

:root {
    color-scheme: light dark;
    --bg: #f7f9fb;
    --surface: #ffffff;
    --surface-strong: #edf1f7;
    --text: #212121;
    --muted: #6b7583;
    --accent: #3478f6;
    --border: #d8dee7;
    --shadow: 0 18px 45px rgba(30, 60, 120, 0.08);
}

.dark-theme {
    --bg: #131a23;
    --surface: #19212d;
    --surface-strong: #252f3f;
    --text: #eef2ff;
    --muted: #9aa7bf;
    --accent: #6ca0ff;
    --border: #2b3749;
    --shadow: none;
}

* {
    box-sizing: border-box;
}

html {
    direction: rtl;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: 'IRANYekanX' !important;
    background: radial-gradient(circle at top, rgba(52, 120, 246, 0.15), transparent 35%), var(--bg);
    color: var(--text);
}

body {
    padding: 24px;
}

.page-shell {
    max-width: 1440px;
    margin: 0 auto;
}

.topbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 28px 28px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.topbar > div:first-child {
    flex: 1 1 auto;
    min-width: 200px;
}

.topbar h1 {
    margin: 0 0 8px;
    font-size: 28px;
}

.topbar p {
    margin: 0;
    color: var(--muted);
}

.theme-toggle {
    font-family: 'IRANYekanX' !important;
    border: none;
    cursor: pointer;
    background: var(--accent);
    color: #fff;
    border-radius: 14px;
    padding: 14px 20px;
    font-size: 14px;
    box-shadow: 0 12px 28px rgba(52, 120, 246, 0.22);
}

.panel {
    margin-top: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-header {
    padding: 24px 28px 12px;
}

.panel-header h2 {
    margin: 0 0 8px;
}

.panel-header p {
    margin: 0;
    color: var(--muted);
}

.table-wrapper {
    overflow-x: auto;
}

.responsive-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 780px;
}

.responsive-table th,
.responsive-table td {
    border-bottom: 1px solid var(--border);
    text-align: right;
    padding: 16px 18px;
    vertical-align: top;
}

.responsive-table th {
    background: var(--surface-strong);
    font-weight: 600;
    color: var(--muted);
    position: sticky;
    top: 0;
    z-index: 1;
}

.row-index {
    width: 52px;
    font-weight: 700;
}

.responsive-table tbody td:nth-child(2) {
    width: 10%;
}

.responsive-table tbody td:nth-child(4) {
    width: 22.5%;
}

.responsive-table tbody td:nth-child(6) {
    width: 155px;
}

.responsive-table tbody td:nth-child(8) {
    width: 115px;
}

.responsive-table tbody td:nth-child(9) {
    width: 150px;
}

input[type='text'],
input[type='url'],
input[type='date'],
textarea,
select {
    font-family: 'IRANYekanX' !important;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
    background: var(--surface-strong);
    color: var(--text);
    font-size: 14px;
}

textarea {
    min-height: 46px;
    resize: none;
    overflow-y: hidden;
}

input:focus,
textarea:focus,
select:focus {
    font-family: 'IRANYekanX' !important;
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(52, 120, 246, 0.12);
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.completed-input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.forced-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #dc2626;
    cursor: pointer;
}

.delete-row-btn {
    font-family: 'IRANYekanX' !important;
    border: 1px solid transparent;
    cursor: pointer;
    color: #fff;
    background: rgba(185, 6, 6, 0.941);
    border-radius: 14px;
    padding: 10px 14px;
    font-size: 13px;
}

.complete-btn {
    font-family: 'IRANYekanX' !important;
    border: none;
    cursor: pointer;
    background: #0aa82f;
    color: #fff;
    border-radius: 14px;
    padding: 10px 14px;
    font-size: 13px;
    transition: background-color 0.2s;
}

.complete-btn:hover {
    background: #059669;
}

.data-row.row-completed {
    background: rgba(49, 172, 67, 0.08);
}

.data-row.row-forced {
    background: rgba(220, 38, 38, 0.1);
}

.header-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.stats-btn {
    font-family: 'IRANYekanX' !important;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 14px;
    padding: 10px 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stats-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.stats-btn-active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.stats-label {
    font-weight: 600;
}

.stats-value {
    font-weight: 700;
    font-size: 14px;
}

.actions-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 15px 24px;
    flex-direction: row;
}

.add-row-btn{
    font-family: 'IRANYekanX' !important;
    border: none;
    cursor: pointer;
    background: #05b72300;
    color: #626b78;
    border-radius: 16px;
    font-size: 15px;
}
.save-row-btn {
    font-family: 'IRANYekanX' !important;
    border: none;
    cursor: pointer;
    background: #05b723;
    color: #ffffff;
    border-radius: 16px;
    padding: 14px 20px;
    font-size: 15px;
}

.save-row-btn {
    margin-left: 12px;
}

.notification,
.autosave-badge {
    position: fixed;
    z-index: 30;
    font-family: 'IRANYekanX' !important;
    border-radius: 16px;
    padding: 14px 18px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
    opacity: 0;
    transform: translateX(-120%) scale(0.95);
    transition: opacity 0.24s ease, transform 0.24s ease;
    pointer-events: none;
}

.notification.visible,
.autosave-badge.visible {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.notification.error {
    background: rgba(185, 28, 28, 0.95);
    color: #ffffff;
}

.left-notification {
    left: 20px;
    bottom: 24px;
    background: rgba(18, 160, 82, 0.95);
    color: #ffffff;
}

.autosave-badge {
    right: 20px;
    bottom: 24px;
    background: rgba(26, 32, 44, 0.95);
    color: #f8fafc;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.autosave-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: #7dd3fc;
    animation: autosave-spin 3s linear infinite;
}

@keyframes autosave-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

input.website-input {
    direction: ltr;
}

@media (max-width: 1040px) {
    .page-shell {
        padding: 0 14px;
    }
}

@media (max-width: 840px) {
    .topbar, .panel-header, .actions-row {
        padding-left: 18px;
        padding-right: 18px;
    }

    body {
        padding: 16px;
    }

    .topbar h1 {
        font-size: 24px;
    }
}

@media (max-width: 760px) {
    .responsive-table {
        min-width: 820px;
    }
}

@media (max-width: 680px) {
    .responsive-table {
        min-width: 100%;
    }

    .responsive-table th,
    .responsive-table td {
        padding: 12px 12px;
    }

    .panel {
        border-radius: 20px;
    }
}
