:root {
    --blue: #2b4dff;
    --purple: #6a2bff;
    --dark: #16181d;
    --bg: #f5f6fa;
    --card-bg: #ffffff;
    --border: #e4e6ec;
    --text: #1c1e26;
    --muted: #6b7280;
    --radius: 14px;
    --shadow: 0 4px 18px rgba(20, 20, 40, 0.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Vazirmatn", Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.brand-logo {
    height: 42px;
}

.header-nav a {
    margin-left: 18px;
    color: var(--dark);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 14px;
    border-radius: 8px;
    transition: background .15s;
}

.header-nav a:hover {
    background: var(--bg);
}

/* Main */
.main-content {
    flex: 1;
    padding: 40px 20px 60px;
}

.hero {
    text-align: center;
    margin-bottom: 40px;
}

.hero-logo {
    max-width: 320px;
    width: 100%;
}

.hero-subtitle {
    color: var(--muted);
    font-size: 16px;
    margin-top: 8px;
}

/* Cards grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 22px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: transform .18s ease, box-shadow .18s ease;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 26px rgba(43, 77, 255, 0.15);
}

.card-image {
    width: 100%;
    height: 150px;
    background: linear-gradient(135deg, #eef1ff, #f7f2ff);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    width: 100%;
    height: 100%;
}

.card-image-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.card-body {
    padding: 16px 18px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 700;
    background: linear-gradient(90deg, var(--purple), var(--blue));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.card-desc {
    margin: 0;
    font-size: 13.5px;
    color: var(--muted);
    line-height: 1.7;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 9px;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(90deg, var(--purple), var(--blue));
    color: #fff;
    border: none;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12.5px;
}

.btn-danger {
    background: #fff0f0;
    color: #d13438;
    border: 1px solid #ffd7d7;
}

/* Forms */
.form-card, .table-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.form-card.narrow {
    max-width: 400px;
    margin: 40px auto;
}

.form-card h2, .form-card h3, .table-card h3 {
    margin-top: 0;
}

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

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

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

.field input, .field textarea, form input[type=password] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    background: #fafbfc;
}

.field input:focus, .field textarea:focus {
    outline: none;
    border-color: var(--blue);
    background: #fff;
}

form label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13.5px; }

.actions-row { display: flex; gap: 10px; }

.page-title {
    margin-bottom: 24px;
}

/* Table */
.table-scroll { overflow-x: auto; }

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

th, td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: right;
    white-space: nowrap;
}

.ellipsis {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-weight: 700;
    background: #fafbfc;
}

.thumb {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.thumb-preview {
    margin-top: 8px;
    height: 60px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

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

/* Stats */
.stats-row {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.stat-box {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 30px;
    box-shadow: var(--shadow);
    text-align: center;
    flex: 1;
}

.stat-number {
    font-size: 34px;
    font-weight: 800;
    background: linear-gradient(90deg, var(--purple), var(--blue));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.stat-label {
    color: var(--muted);
    font-size: 13.5px;
    margin-top: 4px;
}

/* Flash messages */
.flash-wrap { margin-bottom: 20px; }

.flash {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 14px;
}

.flash-success { background: #eafbea; color: #1e7d34; border: 1px solid #c7f0cc; }
.flash-error { background: #fdeaea; color: #c0272d; border: 1px solid #f7cccc; }

/* Footer */
.site-footer {
    text-align: center;
    padding: 20px;
    color: var(--muted);
    font-size: 13px;
    border-top: 1px solid var(--border);
    background: #fff;
}

@media (max-width: 600px) {
    .grid-form { grid-template-columns: 1fr; }
    .stats-row { flex-direction: column; }
    .header-nav a { margin-left: 6px; padding: 6px 8px; font-size: 13px; }
}
