/* --- Global Styles --- */
* {
    font-weight: bold !important;
}
:root {
    --primary-color: #F89C2D;
    --secondary-color: #C82534;
    --dark-color: #171940;
    --light-color: #f7f8f9;
    --text-color: #777;
    --heading-color: #333;
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-color);
    background-color: #FFF;
    line-height: 1.7;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--heading-color);
    font-weight: 600;
}

a {
    color: var(--primary-color);
    transition: color 0.3s ease;
}

a:hover {
    color: var(--secondary-color);
    text-decoration: none;
}

.btn-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 80%);
    border: none;
    color: #FFF;
    padding: 12px 30px;
    font-weight: 600;
    border-radius: 50px;
    transition: transform 0.3s ease;
}

.btn-gradient:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    color: #FFF;
}

.section {
    padding: 80px 0;
}

/* --- Header --- */
.header-modern {
    background-color: #FFF;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-modern .navbar-brand img {
    max-height: 60px;
}

.header-modern .nav-link {
    color: var(--dark-color) !important;
    font-weight: 500;
    padding: 10px 15px !important;
    transition: color 0.3s ease;
}

.header-modern .nav-link.active,
.header-modern .nav-link:hover {
    color: var(--primary-color) !important;
}

/* Language Switcher */
.language-switcher .dropdown-toggle::after {
    display: none;
}

.language-switcher .flag-icon {
    width: 24px;
    height: 18px;
    margin-right: 8px;
}

.language-switcher .dropdown-menu {
    min-width: auto;
}

.language-switcher .dropdown-item {
    display: flex;
    align-items: center;
}


/* --- Hero Section --- */
.hero-section {
    background: linear-gradient(rgba(23, 25, 64, 0.8), rgba(23, 25, 64, 0.8)), url('https://griffin-unlocker.com/img/banner.png') no-repeat center center;
    background-size: cover;
    color: #FFF;
    padding: 120px 0;
    text-align: center;
}

.hero-section h1 {
    font-size: 3.5rem;
    font-weight: 700;
    color: #FFF;
}

.hero-section p {
    font-size: 1.2rem;
    margin-bottom: 30px;
}

/* --- Features Section --- */
.features-section {
    padding: 60px 0;
}

.feature-box {
    padding: 30px;
    border-radius: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-box:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.feature-box img {
    height: 70px;
    margin-bottom: 20px;
}

/* --- Pricing Section --- */
.pricing-table .card {
    border: none;
    border-radius: 10px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}

.pricing-table .card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.1);
}

.pricing-table .card-header {
    background-color: var(--primary-color);
    color: #FFF;
    font-size: 1.5rem;
    font-weight: 600;
    border-radius: 10px 10px 0 0 !important;
}

.pricing-table .card.popular .card-header {
    background-color: var(--dark-color);
}

.pricing-table .card-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark-color);
}

.pricing-table .list-group-item {
    border: none;
}

/* --- Reseller Page --- */
.reseller-card {
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    transition: box-shadow 0.3s ease;
    background-color: #FFF;
}

.reseller-card:hover {
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.reseller-card img {
    width: 100px;
    height: 100px;
    object-fit: contain;     /* تغيرت من cover إلى contain */
    border-radius: 50%;
    background-color: #f8f9fa; /* تمت إضافتها: خلفية رمادية فاتحة للإطار */
    border: 1px solid #dee2e6;  /* تمت إضافتها: إطار خفيف للتحديد */
}

.reseller-card .social-links a {
    color: #333;
    margin: 0 5px;
    font-size: 1.2rem;
}

/* --- Download Page --- */
.download-card {
    background-color: var(--light-color);
    border-radius: 10px;
    padding: 30px;
}

.changelog {
    list-style: none;
    padding-left: 0;
}

.changelog li {
    padding: 15px;
    border-bottom: 1px solid #ddd;
}

.changelog li:last-child {
    border-bottom: none;
}

.changelog .version {
    font-weight: 600;
    color: var(--dark-color);
}

/* --- Footer --- */
.footer {
    background-color: var(--dark-color);
    color: #a9a9a9;
    padding-top: 60px;
}

.footer h5 {
    color: #FFF;
}

.footer a {
    color: #a9a9a9;
}

.footer a:hover {
    color: #FFF;
}

.footer .social-icons a {
    color: #FFF;
    font-size: 1.5rem;
    margin-right: 15px;
}

.footer-bottom {
    background-color: #121433;
    padding: 20px 0;
    border-top: 1px solid #2a2c57;
}

/* --- Professional Page Loading Overlay --- */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #171940; /* لون الخلفية الداكن لموقعك */
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay:not(.active) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-container {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--primary-color); /* اللون البرتقالي */
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px auto;
}

.loader-text {
    color: #FFF;
    font-size: 1.2rem;
    font-weight: 500;
    letter-spacing: 2px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Styling for the new Download Counter --- */
.download-counter-wrapper {
    background-color: #e9ecef; /* لون رمادي فاتح يتناسب مع الخلفية */
    border-radius: 50px;       /* حواف دائرية بالكامل */
    padding: 10px 25px;
    display: inline-flex;      /* لترتيب العناصر بجانب بعضها */
    align-items: center;
    justify-content: center;
    border: 1px solid #dee2e6; /* إطار خفيف */
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); /* ظل خفيف */
}

.download-counter-wrapper .fas {
    font-size: 1.5rem; /* حجم الأيقونة */
    color: var(--primary-color); /* استخدام اللون البرتقالي الأساسي */
    margin-right: 15px; /* مسافة بين الأيقونة والنص */
}

.download-counter-wrapper .counter-label {
    font-size: 1rem;
    color: var(--text-color); /* استخدام لون النص العام */
    font-weight: 500;
    margin-right: 8px;
}

.download-counter-wrapper .counter-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dark-color); /* استخدام اللون الداكن للأرقام */
    background-color: #FFF;
    padding: 2px 12px;
    border-radius: 20px;
    min-width: 40px; /* لضمان حجم ثابت في البداية */
    text-align: center;
}


/* --- Dark Theme Styles (V3 - Final Polished Version) --- */
/* =================== Dark Mode (تُطبَّق عندما يحتوي <body> على .dark-theme) =================== */

/* متغيرات الألوان الخاصة بالـ Dark Mode */
body.dark-theme {
    --primary-color: #F89C2D;      /* برتقالي أساسي */
    --secondary-color: #C82534;    /* أحمر/برتقالي ثانوي */
    --bg-color: #0b0b0d;           /* خلفية عامة أسود جدًا */
    --panel-color: #111213;        /* خلفية البطاقات / الكروت */
    --muted-bg: #141416;           /* خلفيات ثانوية */
    --text-color: #FFFFFF;         /* نص أبيض ساطع كما طلبت */
    --muted-text: #c9c9c9;         /* نص ثانوي فاتح */
    --heading-color: #FFFFFF;      /* عناوين بيضاء */
    --card-border: rgba(255,255,255,0.04);
    --shadow-weak: 0 4px 15px rgba(0,0,0,0.6);
}

/* --- Global overrides --- */
body.dark-theme {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Poppins', sans-serif;
    line-height: 1.7;
}

/* (إذا أردت ضمان استمرار الـ bold كما في CSS الأصلي) */
body.dark-theme * {
    font-weight: bold !important;
}

/* Headings */
body.dark-theme h1,
body.dark-theme h2,
body.dark-theme h3,
body.dark-theme h4,
body.dark-theme h5,
body.dark-theme h6 {
    color: var(--heading-color);
    font-weight: 600;
}

/* Links */
body.dark-theme a {
    color: var(--primary-color);
    transition: color 0.3s ease;
}
body.dark-theme a:hover {
    color: #ffa84d; /* نسخة فاتحة للـ hover */
    text-decoration: none;
}

/* --- Buttons (gradient) - Dark Mode Elegant Version --- */
body.dark-theme .btn-gradient {
    background: transparent;                /* خلفية شفافة */
    border: 2px solid var(--primary-color); /* إطار باللون البرتقالي الأساسي */
    color: var(--primary-color);            /* لون النص برتقالي */
    padding: 10px 28px;                     /* تعديل بسيط للحفاظ على الحجم */
    font-weight: 600;
    border-radius: 50px;
    transition: all 0.3s ease;              /* انتقال ناعم لكل الخصائص */
}

body.dark-theme .btn-gradient:hover {
    background: var(--primary-color);       /* عند الـ hover، تمتلئ الخلفية باللون البرتقالي */
    color: #0b0b0d;                         /* يصبح لون النص داكنًا جدًا للتباين */
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(248, 156, 45, 0.2); /* ظل برتقالي خفيف للتوهج */
}

/* Section spacing (يبقى كما هو) */
body.dark-theme .section {
    padding: 80px 0;
}

/* --- Header --- */
body.dark-theme .header-modern {
    background-color: #0f1012;
    box-shadow: 0 2px 10px rgba(255,255,255,0.02);
}
body.dark-theme .header-modern .navbar-brand img {
    max-height: 60px;
    /* لو تريد تهيئة اللوجو ليظهر بشكل أنيق على الداكن: */
    filter: none;
}
body.dark-theme .header-modern .nav-link {
    color: var(--muted-text) !important;
    font-weight: 500;
    padding: 10px 15px !important;
    transition: color 0.3s ease;
}
body.dark-theme .header-modern .nav-link.active,
body.dark-theme .header-modern .nav-link:hover {
    color: var(--primary-color) !important;
}

/* Language Switcher */
body.dark-theme .language-switcher .dropdown-toggle::after {
    display: none;
}
body.dark-theme .language-switcher .flag-icon {
    width: 24px;
    height: 18px;
    margin-right: 8px;
    filter: none;
}
body.dark-theme .language-switcher .dropdown-menu {
    min-width: auto;
    background-color: var(--panel-color);
    border: 1px solid var(--card-border);
    color: var(--text-color);
}
body.dark-theme .language-switcher .dropdown-item {
    display: flex;
    align-items: center;
    color: var(--text-color);
}

/* --- Hero Section --- */
body.dark-theme .hero-section {
    background: linear-gradient(rgba(11,11,13,0.88), rgba(11,11,13,0.88)), url('https://griffin-unlocker.com/img/banner.png') no-repeat center center;
    background-size: cover;
    color: var(--text-color);
    padding: 120px 0;
    text-align: center;
}
body.dark-theme .hero-section h1 {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--text-color);
}
body.dark-theme .hero-section p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    color: var(--muted-text);
}

/* --- Features Section --- */
body.dark-theme .features-section {
    padding: 60px 0;
}
body.dark-theme .feature-box {
    padding: 30px;
    border-radius: 8px;
    background-color: var(--panel-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    color: var(--text-color);
    border: 1px solid var(--card-border);
}
body.dark-theme .feature-box:hover {
    background: linear-gradient(145deg, #2d2d2d, #1c1c1c);
    border: 1px solid #f8b739; /* إطار ذهبي */
    box-shadow: 0 0 15px rgba(248, 183, 57, 0.6); /* توهج ذهبي */
    transform: translateY(-5px) scale(1.02); /* حركة لطيفة */
}
body.dark-theme .feature-box img {
    height: 70px;
    margin-bottom: 20px;
    /* لا نعكس الألوان تلقائياً كي لا نكسر أيقونات ملونة */
}

/* --- Pricing Section --- */
body.dark-theme .pricing-table .card {
    border: none;
    border-radius: 10px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 5px 20px rgba(0,0,0,0.6);
    background-color: var(--panel-color);
    color: var(--text-color);
    border: 1px solid var(--card-border);
}
body.dark-theme .pricing-table .card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.65);
}
body.dark-theme .pricing-table .card-header {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    color: #0b0b0d; /* سَوَاء على البرتقالي يظهر نص قاتم للوضوح */
    font-size: 1.5rem;
    font-weight: 600;
    border-radius: 10px 10px 0 0 !important;
}
body.dark-theme .pricing-table .card.popular .card-header {
    background-color: #0b0b0d;
    color: #fff;
}
body.dark-theme .pricing-table .card-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
}
body.dark-theme .pricing-table .list-group-item {
    border: none;
    background: transparent;
    color: var(--muted-text);
}

/* --- Reseller Page --- */
body.dark-theme .reseller-card {
    border: 1px solid rgba(255,255,255,0.03);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    transition: box-shadow 0.3s ease;
    background-color: var(--panel-color);
    color: var(--text-color);
        transition: all 0.3s ease-in-out;
    border: 1px solid transparent;

}
body.dark-theme .reseller-card:hover {
    background: linear-gradient(145deg, 255,255,255,0.03);
    border: 1px solid #f8b739; /* إطار ذهبي */
    box-shadow: 0 0 18px rgba(248, 183, 57, 0.7); /* توهج ذهبي أقوى قليلاً */
    transform: translateY(-6px) scale(1.03); /* حركة لطيفة */
}

body.dark-theme .reseller-card img {
    width: 100px;
    height: 100px;
    object-fit: contain;     /* تغيرت من cover إلى contain */
    border-radius: 50%;
    background-color: #2a2c33; /* تمت إضافتها: خلفية داكنة متناسقة للإطار */
    border: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-theme .reseller-card .social-links a {
    color: var(--text-color);
    margin: 0 5px;
    font-size: 1.2rem;
}


/* --- Download Page --- */
body.dark-theme .download-card {
    background-color: var(--muted-bg);
    border-radius: 10px;
    padding: 30px;
    color: var(--text-color);
    border: 1px solid var(--card-border);
}
body.dark-theme .changelog {
    list-style: none;
    padding-left: 0;
    color: var(--muted-text);
}
body.dark-theme .changelog li {
    padding: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
body.dark-theme .changelog li:last-child {
    border-bottom: none;
}
body.dark-theme .changelog .version {
    font-weight: 600;
    color: var(--primary-color);
}

/* --- Footer --- */
body.dark-theme .footer {
    background-color: #070708;
    color: #9ea2a6;
    padding-top: 60px;
}
body.dark-theme .footer h5 {
    color: var(--text-color);
}
body.dark-theme .footer a {
    color: #bfbfbf;
}
body.dark-theme .footer a:hover {
    color: var(--text-color);
}
body.dark-theme .footer .social-icons a {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-right: 15px;
}
body.dark-theme .footer-bottom {
    background-color: #070708;
    padding: 20px 0;
    border-top: 1px solid rgba(255,255,255,0.03);
}

/* --- Professional Page Loading Overlay --- */
body.dark-theme .loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(3,3,3,0.94); /* داكن شبه كامل */
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
body.dark-theme .loading-overlay:not(.active) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
body.dark-theme .loader-container {
    text-align: center;
}
body.dark-theme .spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.06);
    border-top-color: var(--primary-color); /* البرتقالي البارز */
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px auto;
}
body.dark-theme .loader-text {
    color: var(--text-color);
    font-size: 1.2rem;
    font-weight: 500;
    letter-spacing: 2px;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Styling for the Download Counter --- */
body.dark-theme .download-counter-wrapper {
    background-color: var(--panel-color);
    border-radius: 50px;
    padding: 10px 25px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.03);
    box-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
body.dark-theme .download-counter-wrapper .fas {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-right: 15px;
}
body.dark-theme .download-counter-wrapper .counter-label {
    font-size: 1rem;
    color: var(--muted-text);
    font-weight: 500;
    margin-right: 8px;
}
body.dark-theme .download-counter-wrapper .counter-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-color);
    background-color: #000;
    padding: 2px 12px;
    border-radius: 20px;
    min-width: 40px;
    text-align: center;
}

/* --- Small extras to keep visuals متناسقة مع الداكن --- */
/* Ensure cards, lists, and any list-group items are readable */
body.dark-theme .card,
body.dark-theme .list-group-item {
    background-color: transparent;
    color: var(--text-color);
}

/* inputs, selects (لو تستخدمها في الموقع) */
body.dark-theme input,
body.dark-theme textarea,
body.dark-theme select {
    background-color: #0d0d0f;
    color: var(--text-color);
    border: 1px solid rgba(255,255,255,0.03);
    padding: 8px 10px;
    border-radius: 6px;
}

/* Tables (إن وُجدت) */
body.dark-theme table {
    color: var(--text-color);
    border-collapse: collapse;
}
body.dark-theme table th,
body.dark-theme table td {
    border: 1px solid rgba(255,255,255,0.03);
    padding: 8px 10px;
}

/* تدرج الظلال للطباعة الداكنة */
body.dark-theme .shadow-subtle {
    box-shadow: 0 6px 18px rgba(0,0,0,0.6);
}

/* --- Fix text-muted color in dark mode --- */
body.dark-theme .text-muted {
    color: #bbb !important; /* درجة رمادية فاتحة متناسقة مع الداكن */
}

/* --- Fix changelog background --- */
.visiting-card-container img{
    width: 100px;
    height: 100px;
    object-fit: contain;     /* تغيرت من cover إلى contain */
    border-radius: 50%;
    background-color: #2a2c33; /* تمت إضافتها: خلفية داكنة متناسقة للإطار */
    border: 1px solid rgba(255, 255, 255, 0.05);
}
/* --- Fix changelog background --- */
body.dark-theme .visiting-card-container img{
    width: 100px;
    height: 100px;
    object-fit: contain;     /* تغيرت من cover إلى contain */
    border-radius: 50%;
    background-color: #2a2c33; /* تمت إضافتها: خلفية داكنة متناسقة للإطار */
    border: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-theme .visiting-card-container{
    background-color: #212227 !important; /* غامق متناسق مع الداكن */
    color: #eee !important; /* النص يكون فاتح */
}
body.dark-theme .changelog {
    background-color: #1f2233 !important; /* غامق متناسق مع الداكن */
    color: #eee !important; /* النص يكون فاتح */
}

/* --- Fix bg-light inside dark mode (e.g. pricing-table) --- */
body.dark-theme .bg-light {
    background-color: #1f1e1e !important; /* درجة أغمق */
    color: #f1f1f1 !important;
}

/* --- Ensure headings are light in dark mode --- */
body.dark-theme h1, .dark h2, .dark h3, .dark h4, .dark h5, .dark h6 {
    color: #f5f5f5 !important;
}

/* --- Special Manager Button Style (Dark Mode) --- */

/* يستهدف الكود فقط الأزرار في قسم المدراء العلوي */
body.dark-theme .justify-content-center .reseller-card .btn-outline-dark {
    background-color: var(--primary-color);  /* لون أساسي صريح لجذب الانتباه */
    color: #171940;                         /* لون نص داكن جدًا لوضوح عالٍ */
    border: none;                           /* لا حاجة للإطار مع وجود الظل */
    border-radius: 50px;
    padding: 12px 30px;
    font-weight: 700;                       /* وزن خط أثقل للتأكيد */
    box-shadow: 0 5px 20px rgba(0,0,0,0.5), 0 0 12px rgba(248, 156, 45, 0.4); /* ظل أسود للعمق + توهج برتقالي */
    transition: all 0.3s ease;
}

body.dark-theme .justify-content-center .reseller-card .btn-outline-dark:hover {
    background-color: #ffac4e;              /* لون أفتح قليلاً عند الـ hover */
    transform: translateY(-4px);            /* حركة للأعلى بشكل أوضح */
    box-shadow: 0 8px 25px rgba(0,0,0,0.6), 0 0 20px rgba(248, 156, 45, 0.6); /* ظل وتوهج أقوى */
}
/* نهاية ملف Dark Mode */

/* ============================================================================
 * Support Matrix UI — public Models page
 *  Consumes the JSON exported by Griffin Unlocker Pro PHP admin.
 *  Layout : stats banner · search + view switch · brand pills · op cards
 * ========================================================================= */

.models-section {
    padding-top: 60px;
    padding-bottom: 60px;
    background: linear-gradient(180deg, #fafbfc 0%, #f1f4f8 100%);
}

/* ---- Stats banner ---- */
.matrix-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin: 24px 0 32px 0;
}
@media (max-width: 768px) { .matrix-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .matrix-stats { grid-template-columns: 1fr; } }

.matrix-stats-card {
    position: relative;
    background: #FFF;
    border: 1px solid #eaecf0;
    border-radius: 14px;
    padding: 22px 18px 18px;
    text-align: center;
    box-shadow: 0 6px 22px rgba(23, 25, 64, 0.07);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    overflow: hidden;
}
.matrix-stats-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.25s ease;
}
.matrix-stats-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 32px rgba(23, 25, 64, 0.13);
    border-color: rgba(248, 156, 45, 0.45);
}
.matrix-stats-card:hover::before { opacity: 1; }
.matrix-stats-card > i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    font-size: 1.3rem;
    color: var(--primary-color);
    background: rgba(248, 156, 45, 0.12);
    border-radius: 50%;
    transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}
.matrix-stats-card:hover > i {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #FFF;
    transform: scale(1.05);
}
.matrix-stats-num {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.1;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 80%);
    -webkit-background-clip: text;
            background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}
.matrix-stats-stamp {
    font-size: 0.95rem;
    font-weight: 600;
    background: none;
    color: var(--dark-color);
    -webkit-text-fill-color: var(--dark-color);
}
.matrix-stats-label {
    font-size: 0.78rem;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 6px;
}

/* ---- Toolbar : search + view switcher ---- */
.matrix-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin: 8px 0 20px 0;
}
.matrix-search-wrap {
    position: relative;
    flex: 1 1 280px;
}
.matrix-search-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 18px;
    color: var(--text-color);
    pointer-events: none;
    font-size: 0.95rem;
    opacity: 0.7;
}
[dir="rtl"] .matrix-search-icon { left: auto; right: 18px; }

.matrix-search.form-control {
    height: 48px;
    padding-left: 44px;
    padding-right: 16px;
    border-radius: 999px;
    border: 1px solid #e4e7eb;
    background: #FFF;
    color: var(--dark-color);
    font-size: 1rem;
    box-shadow: 0 4px 14px rgba(23, 25, 64, 0.06);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
[dir="rtl"] .matrix-search.form-control { padding-left: 16px; padding-right: 44px; }
.matrix-search.form-control::placeholder { color: #98a0aa; }
.matrix-search.form-control:hover {
    border-color: #d6dae1;
    box-shadow: 0 6px 18px rgba(23, 25, 64, 0.09);
}
.matrix-search.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(248, 156, 45, 0.18);
    outline: none;
}

.matrix-view-switch {
    display: inline-flex;
    background: #FFF;
    border: 1px solid #e4e7eb;
    border-radius: 999px;
    padding: 4px;
    gap: 2px;
    box-shadow: 0 4px 14px rgba(23, 25, 64, 0.06);
}
.matrix-view-btn {
    border: none;
    background: transparent;
    color: var(--dark-color);
    padding: 8px 22px;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}
.matrix-view-btn:hover { color: var(--primary-color); }
.matrix-view-btn.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 80%);
    color: #FFF;
    box-shadow: 0 4px 14px rgba(248, 156, 45, 0.35);
}

/* ---- View panels ---- */
.matrix-view { display: none; }
.matrix-view.active { display: block; }

/* ---- Brand pill grid ---- */
.brand-pill-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 28px;
}
.brand-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px 9px 18px;
    border: 1px solid #e4e7eb;
    background: #FFF;
    color: var(--dark-color);
    border-radius: 999px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.22s ease;
    box-shadow: 0 3px 12px rgba(23, 25, 64, 0.06);
}
.brand-pill:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(248, 156, 45, 0.18);
}
.brand-pill.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #FFF;
    border-color: transparent;
    box-shadow: 0 6px 18px rgba(248, 156, 45, 0.45);
}
.brand-pill-name { font-weight: 700; }
.brand-pill-count {
    background: #f1f4f8;
    color: var(--dark-color);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 0.78rem;
    min-width: 28px;
    text-align: center;
    font-weight: 700;
}
.brand-pill:hover .brand-pill-count {
    background: rgba(248, 156, 45, 0.18);
    color: var(--primary-color);
}
.brand-pill.active .brand-pill-count {
    background: rgba(255, 255, 255, 0.25);
    color: #FFF;
}

/* ---- Brand model table ---- */
.matrix-table-wrap { margin-top: 8px; }
.matrix-table-wrap thead th {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #FFF;
    border: none;
    padding: 14px 16px;
    font-size: 1rem;
}
.brand-table-count {
    display: inline-block;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    padding: 2px 12px;
    font-size: 0.85rem;
    margin-inline-start: 6px;
}
.brand-table-tabs {
    display: inline-block;
    margin-inline-start: 10px;
    font-size: 0.8rem;
    opacity: 0.85;
    font-weight: 500;
}

/* ---- Operations grid ---- */
.ops-grid { display: flex; flex-direction: column; gap: 26px; }

.op-tab-group {
    background: #FFF;
    border: 1px solid #eaecf0;
    border-radius: 14px;
    padding: 20px 22px 24px;
    box-shadow: 0 6px 20px rgba(23, 25, 64, 0.07);
}
.op-tab-title {
    margin: 0 0 14px 0;
    color: var(--dark-color);
    font-size: 1.05rem;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.op-tab-title > i { color: var(--primary-color); }
.op-tab-count {
    background: rgba(248, 156, 45, 0.12);
    color: var(--primary-color);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 0.8rem;
    margin-inline-start: 6px;
}
.op-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}
.op-card {
    background: #fafbfc;
    border: 1px solid #eaecf0;
    border-radius: 12px;
    padding: 13px 14px;
    transition: all 0.22s ease;
}
.op-card:hover {
    background: #FFF;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(248, 156, 45, 0.18);
}
.op-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--dark-color);
    font-weight: 700;
    font-size: 0.98rem;
    margin-bottom: 6px;
}
.op-card-head > i { color: var(--primary-color); font-size: 0.9rem; }
.op-tooltip {
    color: var(--text-color);
    font-size: 0.83rem;
    line-height: 1.45;
    margin-bottom: 8px;
}
.op-aliases { display: flex; flex-wrap: wrap; gap: 4px; }
.op-alias {
    background: rgba(23, 25, 64, 0.06);
    color: var(--dark-color);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 600;
}

/* ---- Empty / error states ---- */
.matrix-empty {
    text-align: center;
    padding: 30px 12px;
    color: var(--text-color);
    margin: 0;
    font-style: italic;
}
.matrix-empty-error { color: var(--secondary-color); font-style: normal; }

/* ============================================================================
 * Modern Models page redesign — sticky toolbar, brand logos, three views,
 * pill size/style variants, density controls, skeletons, animations.
 *
 * Body class hooks (set by models.html applySettings()):
 *   .matrix-pill-size-{compact|comfortable|spacious}
 *   .matrix-pill-style-{text|text-logo|logo}
 *   .matrix-op-density-{compact|comfortable|spacious}
 *   .matrix-accent-{fire|ember|gold}
 *   .matrix-no-counts   .matrix-no-stats
 * ========================================================================= */

/* ---- Hero strip ---- */
.models-hero { text-align: center; margin: 0 0 28px; }
.models-hero-eyebrow {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(248, 156, 45, 0.10);
    border: 1px solid rgba(248, 156, 45, 0.32);
    padding: 4px 12px;
    border-radius: 999px;
    margin-bottom: 14px;
}
.models-hero h2 {
    font-size: clamp(1.7rem, 3vw, 2.4rem);
    font-weight: 800;
    margin: 0 0 8px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 80%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
.models-hero p.lead {
    color: var(--text-color);
    max-width: 680px;
    margin: 0 auto;
    font-size: 1rem;
    opacity: 0.85;
}

/* ---- Stats card icon (new wrapped span instead of bare <i>) ---- */
.matrix-stats-icon {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 50px; height: 50px;
    margin-bottom: 10px;
    background: rgba(248, 156, 45, 0.15);
    color: var(--primary-color);
    border-radius: 50%;
    transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
    font-size: 1.4rem;
}
.matrix-stats-card:hover .matrix-stats-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #FFF;
    transform: scale(1.05);
}

/* ---- Sticky toolbar redesign ---- */
.matrix-toolbar {
    position: sticky;
    top: 70px;          /* below the navbar */
    z-index: 8;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border: 1px solid #e4e7eb;
    border-radius: 999px;
    padding: 8px 10px;
    box-shadow: 0 6px 22px rgba(23, 25, 64, 0.07);
    margin: 8px 0 14px;
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}
.matrix-toolbar:hover { box-shadow: 0 12px 30px rgba(23, 25, 64, 0.10); }

.matrix-search-wrap { position: relative; flex: 1 1 280px; }
.matrix-search-icon { color: #98a0aa; font-size: 0.95rem; }
.matrix-search {
    width: 100%;
    height: 44px;
    padding-left: 44px;
    padding-right: 44px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.95rem;
    color: var(--dark-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
[dir="rtl"] .matrix-search { padding-left: 44px; padding-right: 44px; }
.matrix-search::placeholder { color: #98a0aa; }
.matrix-search:focus {
    outline: none;
    background: #FFF;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(248, 156, 45, 0.18);
}
.matrix-search-clear {
    position: absolute;
    top: 50%; right: 12px;
    transform: translateY(-50%);
    width: 28px; height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    color: var(--dark-color);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex; align-items: center; justify-content: center;
}
[dir="rtl"] .matrix-search-clear { right: auto; left: 12px; }
.matrix-search-clear:hover { background: rgba(248, 156, 45, 0.20); color: var(--primary-color); }

.matrix-view-switch {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    gap: 4px;
}
.matrix-view-btn {
    height: 40px;
    padding: 8px 18px;
    border-radius: 999px;
    font-weight: 600;
    color: var(--text-color);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.matrix-view-btn:hover { background: rgba(248, 156, 45, 0.10); color: var(--primary-color); }
.matrix-view-btn.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 80%);
    color: #FFF;
    box-shadow: 0 6px 18px rgba(248, 156, 45, 0.45);
}
.matrix-view-btn i { font-size: 0.92rem; }

/* ---- Result chip (live counts during search) ---- */
.matrix-result-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    padding: 8px 14px;
    background: rgba(248, 156, 45, 0.10);
    border: 1px solid rgba(248, 156, 45, 0.32);
    color: var(--dark-color);
    border-radius: 999px;
    font-size: 0.86rem;
    animation: chipIn 220ms ease both;
}
.matrix-result-chip i { color: var(--primary-color); }
.matrix-result-chip strong { color: var(--primary-color); }
@keyframes chipIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Brand pill grid (logo + text + count) ---- */
.brand-pill-grid {
    display: flex; flex-wrap: wrap; gap: 10px;
    justify-content: center;
    margin-bottom: 28px;
}
.brand-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: #FFF;
    border: 1px solid #e4e7eb;
    border-radius: 999px;
    color: var(--dark-color);
    cursor: pointer;
    transition: transform 0.22s ease, box-shadow 0.22s ease,
                border-color 0.22s ease, background 0.22s ease;
    box-shadow: 0 3px 12px rgba(23, 25, 64, 0.06);
    animation: pillIn 320ms ease both;
}
.brand-pill > .brand-pill-name { font-weight: 700; font-size: 0.92rem; line-height: 1.1; }
@keyframes pillIn { from { opacity: 0; transform: translateY(8px) scale(0.96); } to { opacity: 1; transform: none; } }

.brand-pill:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(248, 156, 45, 0.22);
}
.brand-pill.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #FFF;
    border-color: transparent;
    box-shadow: 0 10px 26px rgba(248, 156, 45, 0.50);
}
.brand-pill-count {
    background: #f1f4f8;
    color: var(--dark-color);
    border-radius: 999px;
    padding: 2px 10px;
    min-width: 24px;
    font-size: 0.74rem;
    text-align: center;
    font-weight: 700;
}
.brand-pill:hover .brand-pill-count { background: rgba(248, 156, 45, 0.20); color: var(--primary-color); }
.brand-pill.active .brand-pill-count { background: rgba(0, 0, 0, 0.18); color: #FFF; }

/* ---- Brand logo + letter avatar ---- */
.brand-logo {
    width: 24px; height: 24px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center; justify-content: center;
    border-radius: 6px;
    overflow: hidden;
    background: #f1f4f8;
}
.brand-logo img {
    width: 100%; height: 100%;
    object-fit: contain;
    background: #FFF;
}
.brand-logo-letter {
    color: #FFF;
    font-weight: 800;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.brand-pill.active .brand-logo {
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

/* ---- Body-driven pill size + style variants ---- */
body.matrix-pill-size-compact .brand-pill {
    padding: 6px 13px; gap: 8px;
}
body.matrix-pill-size-compact .brand-pill-name { font-size: 0.84rem; }
body.matrix-pill-size-compact .brand-logo { width: 20px; height: 20px; }

body.matrix-pill-size-spacious .brand-pill {
    padding: 14px 22px; gap: 12px;
}
body.matrix-pill-size-spacious .brand-pill-name { font-size: 1.0rem; }
body.matrix-pill-size-spacious .brand-logo { width: 30px; height: 30px; }

body.matrix-pill-style-text .brand-pill > .brand-logo { display: none; }
body.matrix-pill-style-logo .brand-pill > .brand-pill-name { display: none; }
body.matrix-pill-style-logo .brand-pill { padding-left: 12px; padding-right: 12px; }

body.matrix-no-counts .brand-pill-count { display: none; }
body.matrix-no-stats  .matrix-stats { display: none; }

/* ---- Skeleton pills (shown while matrix is loading) ---- */
.brand-pill.skeleton {
    width: 120px; height: 40px;
    cursor: default; pointer-events: none;
    background: linear-gradient(90deg, #f1f4f8 0%, #e9edf2 50%, #f1f4f8 100%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.4s ease-in-out infinite;
    border-color: transparent;
    box-shadow: none;
}
@keyframes skeletonShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---- Brand-detail panel ---- */
.matrix-brand-detail {
    background: #FFF;
    border: 1px solid #eaecf0;
    border-radius: 18px;
    padding: 22px 24px 26px;
    margin-top: 8px;
    box-shadow: 0 14px 38px rgba(23, 25, 64, 0.08);
    animation: panelIn 320ms ease both;
}
@keyframes panelIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.matrix-brand-head {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
    border-bottom: 1px solid #eef0f3;
    padding-bottom: 16px;
    margin-bottom: 18px;
}
.matrix-brand-head-id { display: flex; align-items: center; gap: 14px; }
.matrix-brand-head-logo { width: 56px; height: 56px; border-radius: 14px; overflow: hidden; box-shadow: 0 6px 16px rgba(23, 25, 64, 0.10); }
.matrix-brand-head-logo .brand-logo,
.matrix-brand-head-logo .brand-logo-letter {
    width: 100%; height: 100%; border-radius: 14px; font-size: 1.4rem;
}
.matrix-brand-head h3 {
    margin: 0; font-size: 1.4rem; font-weight: 800; color: var(--dark-color);
}
.matrix-brand-head small { color: var(--text-color); opacity: 0.8; font-size: 0.86rem; }

.matrix-brand-head-actions { display: flex; align-items: center; gap: 8px; }
.matrix-mini-search-wrap {
    position: relative;
    background: #f6f8fb;
    border: 1px solid #e4e7eb;
    border-radius: 999px;
    padding: 6px 14px 6px 36px;
    transition: all 0.2s ease;
}
[dir="rtl"] .matrix-mini-search-wrap { padding: 6px 36px 6px 14px; }
.matrix-mini-search-wrap > i {
    position: absolute; top: 50%; left: 14px; transform: translateY(-50%);
    color: #98a0aa; font-size: 0.85rem;
}
[dir="rtl"] .matrix-mini-search-wrap > i { left: auto; right: 14px; }
.matrix-mini-search-wrap input {
    border: none; background: transparent; outline: none;
    height: 28px; font-size: 0.88rem; color: var(--dark-color);
    width: 200px;
}
.matrix-mini-search-wrap:focus-within {
    border-color: var(--primary-color);
    background: #FFF;
    box-shadow: 0 0 0 3px rgba(248, 156, 45, 0.18);
}
.matrix-mini-btn {
    width: 36px; height: 36px;
    border-radius: 50%; border: 1px solid #e4e7eb;
    background: #FFF; cursor: pointer;
    color: var(--dark-color);
    transition: all 0.2s ease;
    display: inline-flex; align-items: center; justify-content: center;
}
.matrix-mini-btn:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    background: rgba(200, 37, 52, 0.08);
}

.matrix-brand-tabs {
    display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px;
}
.brand-tab-chip {
    background: rgba(248, 156, 45, 0.10);
    color: var(--primary-color);
    border: 1px solid rgba(248, 156, 45, 0.32);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
}

/* ---- Brand-detail model grid + matrix-model-card (also reused by Models view) ---- */
.matrix-models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}
.matrix-model-card {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    background: #fafbfc;
    border: 1px solid #eaecf0;
    border-radius: 10px;
    color: var(--dark-color);
    text-decoration: none;
    font-size: 0.88rem;
    line-height: 1.3;
    transition: all 0.18s ease;
    word-break: break-word;
    animation: cardIn 240ms ease both;
}
.matrix-model-card:hover {
    background: #FFF;
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(248, 156, 45, 0.18);
}
.matrix-model-card > i {
    color: var(--primary-color);
    flex: 0 0 auto;
    font-size: 0.9rem;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.matrix-empty-pad { padding: 60px 24px !important; }

/* ---- All-models view ---- */
.matrix-allmodels {
    display: flex; flex-direction: column; gap: 18px;
}
.allmodels-group {
    background: #FFF;
    border: 1px solid #eaecf0;
    border-radius: 16px;
    padding: 18px 22px 22px;
    box-shadow: 0 6px 20px rgba(23, 25, 64, 0.06);
}
.allmodels-head {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eef0f3;
}
.allmodels-head .brand-logo,
.allmodels-head .brand-logo-letter {
    width: 36px; height: 36px;
    border-radius: 10px; font-size: 0.92rem;
}
.allmodels-head h4 {
    margin: 0; flex: 1;
    font-size: 1.05rem; font-weight: 700;
    color: var(--dark-color);
}
.allmodels-count {
    background: rgba(248, 156, 45, 0.12);
    color: var(--primary-color);
    border-radius: 999px;
    padding: 3px 12px;
    font-size: 0.76rem;
    font-weight: 700;
}
.allmodels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 6px;
}

/* ---- Operation cards: density variants ---- */
body.matrix-op-density-compact .op-card { padding: 8px 12px; }
body.matrix-op-density-compact .op-card-head { font-size: 0.92rem; margin-bottom: 4px; }
body.matrix-op-density-compact .op-tooltip   { font-size: 0.78rem; -webkit-line-clamp: 2; line-clamp: 2; }
body.matrix-op-density-compact .op-aliases   { display: none; }

body.matrix-op-density-spacious .op-card { padding: 18px 20px; }
body.matrix-op-density-spacious .op-card-head { font-size: 1.05rem; }
body.matrix-op-density-spacious .op-card-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.op-card-icon {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 26px; height: 26px;
    background: rgba(248, 156, 45, 0.12);
    color: var(--primary-color);
    border-radius: 7px;
    font-size: 0.78rem;
    flex: 0 0 auto;
}
.op-card-label { font-weight: 700; }
.op-tooltip {
    color: var(--text-color);
    font-size: 0.83rem;
    margin: 4px 0 8px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    opacity: 0.85;
}
.op-aliases { display: flex; flex-wrap: wrap; gap: 4px; }
.op-alias {
    background: #f1f4f8;
    color: var(--text-color);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 600;
}
.op-alias-more {
    background: rgba(248, 156, 45, 0.15);
    color: var(--primary-color);
}

/* ---- Accent themes ---- */
body.matrix-accent-ember {
    --primary-color: #ff6a3d;
    --secondary-color: #c82534;
}
body.matrix-accent-gold {
    --primary-color: #f8b739;
    --secondary-color: #f89c2d;
}

/* ---- Responsive ---- */
@media (max-width: 720px) {
    .matrix-toolbar { border-radius: 18px; padding: 10px 12px; flex-direction: column; align-items: stretch; }
    .matrix-search-wrap { flex: 1 1 auto; }
    .matrix-view-switch { width: 100%; justify-content: stretch; gap: 6px; }
    .matrix-view-btn { flex: 1; justify-content: center; }
    .matrix-brand-head { flex-direction: column; align-items: flex-start; }
    .matrix-mini-search-wrap input { width: 140px; }
}

/* ============================================================================
 * Dark theme overrides for Support Matrix UI
 * ========================================================================= */
body.dark-theme .models-section {
    background: linear-gradient(180deg, var(--bg-color) 0%, #0e0f12 100%);
}

body.dark-theme .matrix-stats-card {
    background: var(--panel-color);
    border-color: var(--card-border);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.5);
}
body.dark-theme .matrix-stats-card:hover {
    border-color: rgba(248, 156, 45, 0.5);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.65);
}
body.dark-theme .matrix-stats-card > i {
    background: rgba(248, 156, 45, 0.15);
}
body.dark-theme .matrix-stats-card:hover > i {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #0b0b0d;
}
/* The number keeps its gradient text in dark too — no override needed.   */
body.dark-theme .matrix-stats-stamp {
    color: var(--text-color);
    -webkit-text-fill-color: var(--text-color);
}
body.dark-theme .matrix-stats-label { color: var(--muted-text); }

body.dark-theme .matrix-search.form-control {
    background: #0d0d0f;
    color: var(--text-color);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
body.dark-theme .matrix-search.form-control::placeholder { color: var(--muted-text); }
body.dark-theme .matrix-search.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(248, 156, 45, 0.25);
}
body.dark-theme .matrix-search-icon { color: var(--muted-text); }

body.dark-theme .matrix-view-switch {
    background: var(--panel-color);
    border: 1px solid var(--card-border);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
body.dark-theme .matrix-view-btn        { color: var(--muted-text); }
body.dark-theme .matrix-view-btn:hover  { color: var(--primary-color); }
body.dark-theme .matrix-view-btn.active {
    color: #0b0b0d;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

body.dark-theme .brand-pill {
    background: var(--panel-color);
    color: var(--text-color);
    border-color: var(--card-border);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
body.dark-theme .brand-pill:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 8px 20px rgba(248, 156, 45, 0.22);
}
body.dark-theme .brand-pill.active {
    /* Re-declare the orange gradient at higher specificity than the
       generic `body.dark-theme .brand-pill { background: ... }` rule below,
       otherwise the active state inherits the dark panel background and
       the text + count become invisible (dark-on-dark). */
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #0b0b0d;
    border-color: transparent;
    box-shadow: 0 8px 22px rgba(248, 156, 45, 0.5);
}
body.dark-theme .brand-pill-count {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-color);
}
body.dark-theme .brand-pill:hover .brand-pill-count {
    background: rgba(248, 156, 45, 0.22);
    color: var(--primary-color);
}
body.dark-theme .brand-pill.active .brand-pill-count {
    background: rgba(0, 0, 0, 0.22);
    color: #0b0b0d;
}

/* Brand table inside dark theme — neutralize Bootstrap variables */
body.dark-theme .matrix-table-wrap thead th { color: #0b0b0d; }
body.dark-theme .matrix-table-wrap .table {
    --bs-table-bg: var(--panel-color);
    --bs-table-color: var(--text-color);
    --bs-table-striped-bg: var(--muted-bg);
    --bs-table-striped-color: var(--text-color);
    --bs-table-hover-bg: rgba(248, 156, 45, 0.08);
    --bs-table-hover-color: var(--text-color);
    --bs-table-border-color: var(--card-border);
    color: var(--text-color);
}

body.dark-theme .op-tab-group {
    background: var(--panel-color);
    border-color: var(--card-border);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}
body.dark-theme .op-tab-title { color: var(--text-color); }
body.dark-theme .op-tab-count {
    background: rgba(248, 156, 45, 0.18);
    color: var(--primary-color);
}
body.dark-theme .op-card {
    background: var(--muted-bg);
    border-color: var(--card-border);
}
body.dark-theme .op-card:hover {
    background: #1b1c20;
    border-color: var(--primary-color);
    box-shadow: 0 8px 22px rgba(248, 156, 45, 0.22);
}
body.dark-theme .op-card-head { color: var(--text-color); }
body.dark-theme .op-tooltip   { color: var(--muted-text); }
body.dark-theme .op-alias {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-color);
}

body.dark-theme .matrix-empty       { color: var(--muted-text); }
body.dark-theme .matrix-empty-error { color: var(--secondary-color); }

/* ---------- Dark theme: modern Models redesign ---------- */
body.dark-theme .models-hero p.lead { color: var(--muted-text); }
body.dark-theme .models-hero-eyebrow {
    color: var(--primary-color);
    background: rgba(248, 156, 45, 0.14);
    border-color: rgba(248, 156, 45, 0.40);
}

body.dark-theme .matrix-stats-icon {
    background: rgba(248, 156, 45, 0.16);
    color: var(--primary-color);
}
body.dark-theme .matrix-stats-card:hover .matrix-stats-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #0b0b0d;
}

body.dark-theme .matrix-toolbar {
    background: rgba(20, 21, 24, 0.78);
    border-color: var(--card-border);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55);
}
body.dark-theme .matrix-toolbar:hover { box-shadow: 0 14px 36px rgba(0, 0, 0, 0.65); }
body.dark-theme .matrix-search { color: var(--text-color); }
body.dark-theme .matrix-search:focus { background: var(--panel-color); }
body.dark-theme .matrix-search-clear {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-color);
}
body.dark-theme .matrix-search-clear:hover {
    background: rgba(248, 156, 45, 0.22); color: var(--primary-color);
}
body.dark-theme .matrix-view-btn { color: var(--text-color); }
body.dark-theme .matrix-view-btn:hover { background: rgba(248, 156, 45, 0.12); }
body.dark-theme .matrix-view-btn.active { color: #0b0b0d; }

body.dark-theme .matrix-result-chip {
    background: rgba(248, 156, 45, 0.12);
    border-color: rgba(248, 156, 45, 0.40);
    color: var(--text-color);
}

body.dark-theme .brand-pill {
    background: var(--panel-color);
    color: var(--text-color);
    border-color: var(--card-border);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
body.dark-theme .brand-pill:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 8px 20px rgba(248, 156, 45, 0.22);
}
/* Re-declare gradient at higher specificity than the dark-theme generic rule. */
body.dark-theme .brand-pill.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #0b0b0d;
    border-color: transparent;
    box-shadow: 0 8px 22px rgba(248, 156, 45, 0.5);
}
body.dark-theme .brand-pill-count {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-color);
}
body.dark-theme .brand-pill:hover .brand-pill-count {
    background: rgba(248, 156, 45, 0.22);
    color: var(--primary-color);
}
body.dark-theme .brand-pill.active .brand-pill-count {
    background: rgba(0, 0, 0, 0.22);
    color: #0b0b0d;
}

body.dark-theme .brand-logo {
    background: rgba(255, 255, 255, 0.06);
}
body.dark-theme .brand-pill.active .brand-logo {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
}

body.dark-theme .brand-pill.skeleton {
    background: linear-gradient(90deg, #18191d 0%, #1f2024 50%, #18191d 100%);
    background-size: 200% 100%;
}

body.dark-theme .matrix-brand-detail {
    background: var(--panel-color);
    border-color: var(--card-border);
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.55);
}
body.dark-theme .matrix-brand-head { border-bottom-color: var(--card-border); }
body.dark-theme .matrix-brand-head h3 { color: var(--text-color); }
body.dark-theme .matrix-brand-head small { color: var(--muted-text); }
body.dark-theme .matrix-mini-search-wrap {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--card-border);
}
body.dark-theme .matrix-mini-search-wrap input { color: var(--text-color); }
body.dark-theme .matrix-mini-search-wrap:focus-within { background: var(--bg-color); }
body.dark-theme .matrix-mini-btn {
    background: var(--bg-color);
    border-color: var(--card-border);
    color: var(--text-color);
}
body.dark-theme .matrix-mini-btn:hover {
    background: rgba(200, 37, 52, 0.12);
    color: var(--secondary-color);
    border-color: var(--secondary-color);
}
body.dark-theme .brand-tab-chip {
    background: rgba(248, 156, 45, 0.12);
    color: var(--primary-color);
    border-color: rgba(248, 156, 45, 0.40);
}

body.dark-theme .matrix-model-card {
    background: var(--muted-bg);
    border-color: var(--card-border);
    color: var(--text-color);
}
body.dark-theme .matrix-model-card:hover {
    background: #1b1c20;
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 8px 22px rgba(248, 156, 45, 0.20);
}

body.dark-theme .allmodels-group {
    background: var(--panel-color);
    border-color: var(--card-border);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}
body.dark-theme .allmodels-head { border-bottom-color: var(--card-border); }
body.dark-theme .allmodels-head h4 { color: var(--text-color); }
body.dark-theme .allmodels-count {
    background: rgba(248, 156, 45, 0.14);
    color: var(--primary-color);
}

body.dark-theme .op-card-icon {
    background: rgba(248, 156, 45, 0.14);
    color: var(--primary-color);
}
body.dark-theme .op-alias-more {
    background: rgba(248, 156, 45, 0.20);
    color: var(--primary-color);
}
