@font-face {
    font-family: 'MirrorFont';
    src: url('../fonts/MirrorFont.woff2') format('woff2'),
         url('../fonts/MirrorFont.woff') format('woff'),
         url('../fonts/MirrorFont.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --mh-font: 'MirrorFont', 'Vazirmatn', 'Tahoma', system-ui, -apple-system, sans-serif;
    --mh-radius: 0.75rem;
}

body {
    font-family: var(--mh-font);
    font-feature-settings: "ss01";
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
}

.min-w-0 {
    min-width: 0;
}

.mh-logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #0d6efd;
    background: linear-gradient(135deg, var(--mh-primary), color-mix(in srgb, var(--mh-primary) 60%, #000));
    color: #fff;
    font-weight: 900;
    font-size: 16px;
    flex-shrink: 0;
}

.btn-primary {
    --bs-btn-bg: var(--mh-primary);
    --bs-btn-border-color: var(--mh-primary);
    --bs-btn-hover-bg: var(--mh-primary);
    --bs-btn-hover-border-color: var(--mh-primary);
    --bs-btn-active-bg: var(--mh-primary);
    --bs-btn-active-border-color: var(--mh-primary);
    --bs-btn-disabled-bg: var(--mh-primary);
    --bs-btn-disabled-border-color: var(--mh-primary);
    background-color: var(--mh-primary);
    border-color: var(--mh-primary);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    filter: brightness(0.9);
}

@supports (background: color-mix(in srgb, red 50%, blue)) {
    .btn-primary {
        --bs-btn-hover-bg: color-mix(in srgb, var(--mh-primary) 85%, #000);
        --bs-btn-hover-border-color: color-mix(in srgb, var(--mh-primary) 85%, #000);
        --bs-btn-active-bg: color-mix(in srgb, var(--mh-primary) 75%, #000);
        --bs-btn-active-border-color: color-mix(in srgb, var(--mh-primary) 75%, #000);
    }

    .btn-primary:hover,
    .btn-primary:focus,
    .btn-primary:active {
        filter: none;
    }
}

.btn-outline-primary {
    --bs-btn-color: var(--mh-primary);
    --bs-btn-border-color: var(--mh-primary);
    --bs-btn-hover-bg: var(--mh-primary);
    --bs-btn-hover-border-color: var(--mh-primary);
    --bs-btn-active-bg: var(--mh-primary);
    --bs-btn-active-border-color: var(--mh-primary);
}

a {
    color: var(--mh-primary);
    text-decoration: none;
}

a:hover {
    filter: brightness(0.85);
}

.dropdown-menu.mh-cat-menu {
    max-height: 60vh;
    overflow-y: auto;
    min-width: 240px;
}

.mh-hero {
    background: linear-gradient(135deg, color-mix(in srgb, var(--mh-primary) 12%, transparent), transparent 60%);
}

.mh-search-input {
    padding-right: 3rem;
    padding-left: 3rem;
    height: 52px;
    border-radius: 999px;
}

.mh-search-icon {
    position: absolute;
    right: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--bs-secondary-color);
    pointer-events: none;
}

.mh-search-btn {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.stat-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
}

.category-card,
.mirror-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    color: inherit;
}

.category-card:hover,
.mirror-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
    border-color: var(--mh-primary) !important;
    color: inherit;
}

.category-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.85rem;
    background: color-mix(in srgb, var(--mh-primary) 12%, transparent);
    color: var(--mh-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mirror-card-title {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mirror-card-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}

.mh-thumb {
    width: 48px;
    height: 48px;
    border-radius: var(--mh-radius);
    background: var(--bs-tertiary-bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--bs-border-color);
    color: var(--mh-primary);
    font-weight: 800;
    flex-shrink: 0;
}

.mh-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mh-thumb-lg {
    width: 88px;
    height: 88px;
    border-radius: 1.25rem;
    font-size: 32px;
}

.mh-thumb-sm {
    width: 34px;
    height: 34px;
    border-radius: 0.5rem;
    font-size: 13px;
}

.table > :not(caption) > * > * {
    vertical-align: middle;
}

.card {
    --bs-card-border-radius: var(--mh-radius);
}

.breadcrumb {
    font-size: 0.875rem;
    margin-bottom: 0;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--mh-primary);
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--mh-primary) 25%, transparent);
}

.mh-empty {
    padding: 4rem 1rem;
    text-align: center;
    color: var(--bs-secondary-color);
}

.mh-empty-icon {
    font-size: 3rem;
    color: var(--mh-primary);
    opacity: 0.55;
    display: block;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .mh-thumb-lg {
        width: 64px;
        height: 64px;
        font-size: 24px;
    }
    .mh-search-input {
        height: 46px;
        font-size: 0.95rem;
    }
}

[data-bs-theme="dark"] .card {
    --bs-card-bg: var(--bs-body-bg);
    --bs-card-border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .bg-body-tertiary {
    background-color: #0f111a !important;
}

[data-bs-theme="dark"] .table {
    --bs-table-bg: transparent;
}

textarea.form-control {
    line-height: 1.9;
}

.fade-in-up {
    animation: mhFadeInUp 0.45s ease both;
}

@keyframes mhFadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .fade-in-up {
        animation: none;
    }
}