/*
 * Category Cards Inline Styles
 * تصميم بطاقات التصنيفات مع نظام Pagination
 * 
 * @version 2.0.0 (October 2025)
 */

/* ========================================
   Category Section Wrapper
   ======================================== */
.category-section {
    direction: rtl;
    margin-bottom: 24px;
    padding: 22px 24px 26px;
    border-radius: 18px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 40%, #0ea5e9 100%);
    box-shadow: 0 35px 60px -45px rgba(79, 70, 229, 0.8);
    position: relative;
    overflow: hidden;
    color: #ffffff;
}

.category-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(255,255,255,0.22), transparent 55%);
    pointer-events: none;
    z-index: 0;
}

.category-section__header,
.category-section__body,
.category-section__footer,
.category-section__controls,
.category-section__title {
    position: relative;
    z-index: 1;
}

.category-section__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.category-section__title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.category-section__title i {
    background: rgba(255,255,255,0.15);
    border-radius: 16px;
    padding: 12px;
    font-size: 20px;
}

.category-section__title h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #ffffff;
}

.category-section__title p {
    margin: 4px 0 0;
    font-size: 13px;
    color: rgba(255,255,255,0.85);
}

.category-section__controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
}

.category-type-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.25);
}

.category-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 0;
    background: transparent;
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-view-btn.active {
    background: rgba(255,255,255,0.92);
    color: #4f46e5;
    box-shadow: 0 10px 24px -12px rgba(255,255,255,0.8);
}

.category-view-btn i {
    font-size: 14px;
}

.category-loading {
    display: none;
    text-align: center;
    padding: 28px 10px;
}

.category-loading .loading-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.35);
    border-top-color: #ffffff;
    animation: spin 1s linear infinite;
}

.category-loading p {
    margin-top: 12px;
    font-size: 13px;
    color: rgba(255,255,255,0.85);
}

.category-section__body {
    position: relative;
    z-index: 1;
}

.category-section__footer {
    margin-top: 18px;
    text-align: center;
}

.category-empty {
    display: none;
    text-align: center;
    padding: 36px 20px;
    border-radius: 14px;
    background: rgba(255,255,255,0.16);
    border: 1px dashed rgba(255,255,255,0.3);
    margin-top: 18px;
}

.category-empty i {
    font-size: 42px;
    margin-bottom: 10px;
    opacity: 0.75;
}

.category-empty h4 {
    margin: 0 0 6px;
    font-size: 16px;
}

.category-empty p {
    margin: 0;
    font-size: 13px;
    color: rgba(255,255,255,0.82);
}

@media (max-width: 992px) {
    .category-section {
        padding: 20px;
    }

    .category-section__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .category-section__controls {
        width: 100%;
        justify-content: space-between;
        gap: 10px;
    }

    .category-view-toggle {
        margin-inline-start: auto;
    }
}

@media (max-width: 640px) {
    .category-section {
        padding: 18px;
        border-radius: 16px;
    }

    .category-section__controls {
        flex-direction: column;
        align-items: stretch;
    }

    .category-view-toggle {
        width: 100%;
        justify-content: space-between;
    }
}

/* ========================================
   Category Cards Grid - Responsive Layouts
   ======================================== */
.category-cards-grid-inline {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    padding: 4px 0;
}

.category-cards-grid-inline[data-view="list"] {
    grid-template-columns: 1fr;
}

/* ========================================
   Inline Category Card - Compact Design
   ======================================== */
.category-cards-grid-inline .category-card {
    display: none;
    flex-direction: column;
    gap: 16px;
    padding: 20px 22px;
    border-radius: 18px;
    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(255,255,255,0.6);
    box-shadow: 0 24px 45px -28px rgba(15, 23, 42, 0.45);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    min-height: 170px;
    transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

.category-cards-grid-inline .category-card::after {
    content: '';
    position: absolute;
    inset-inline-start: -40px;
    inset-block-start: -60px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(99,102,241,0.18), transparent 60%);
    transform: rotate(25deg);
}

.category-cards-grid-inline .category-card.is-visible {
    display: flex !important;
}

.category-cards-grid-inline .category-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 30px 60px -32px rgba(15, 23, 42, 0.55);
    border-color: rgba(79, 70, 229, 0.25);
}

.category-cards-grid-inline[data-view="list"] .category-card.is-visible {
    flex-direction: row;
    align-items: center;
    gap: 22px;
    min-height: 140px;
    padding-inline: 28px;
}

.category-cards-grid-inline[data-view="list"] .category-card::after {
    inset-inline-start: -20px;
    inset-block-start: auto;
    bottom: -40px;
}

/* ========================================
   Category Type Buttons
   ======================================== */
.category-type-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.category-type-btn:not(.active) {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.category-type-btn:not(.active):hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.category-type-btn.active {
    background: rgba(255, 255, 255, 0.95);
    color: #667eea;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.category-type-btn i {
    margin-left: 6px;
}

/* ========================================
   Show More Button Animation
   ======================================== */
#show-more-categories {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
    50% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    }
}

#show-more-categories:hover {
    background: #667eea;
    color: white;
    transform: translateY(-50%) scale(1.1);
}

/* ========================================
   Compact Card Header
   ======================================== */
.category-cards-grid-inline .category-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: relative;
    z-index: 1;
}

.category-cards-grid-inline .category-card-icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-size: 28px;
    color: #4f46e5;
    background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(129,140,248,0.25));
    transition: all 0.35s ease;
}

.category-cards-grid-inline .category-card:hover .category-card-icon {
    transform: translateY(-4px) scale(1.07);
    background: linear-gradient(135deg, rgba(79,70,229,0.25), rgba(59,130,246,0.28));
}

.category-cards-grid-inline .category-card-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #ffffff;
    border-radius: 999px;
    font-size: 18px;
    font-weight: 700;
    box-shadow: 0 12px 30px -18px rgba(79, 70, 229, 0.8);
}

.category-cards-grid-inline[data-view="list"] .category-card-header {
    flex-direction: row-reverse;
    justify-content: flex-start;
    gap: 24px;
}

.category-cards-grid-inline[data-view="list"] .category-card-count {
    font-size: 20px;
    padding-inline: 18px;
}

/* ========================================
   Compact Card Body
   ======================================== */
.category-cards-grid-inline .category-card-title {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 6px;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-cards-grid-inline[data-view="list"] .category-card-title {
    white-space: normal;
    max-width: 420px;
}

.category-cards-grid-inline .category-card-subtitle {
    font-size: 13px;
    color: #475569;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-cards-grid-inline .category-card-subtitle::before {
    content: '\f201';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 11px;
    color: #6366f1;
}

.category-cards-grid-inline .category-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    z-index: 1;
    color: #1f2937;
}

.category-cards-grid-inline[data-view="list"] .category-card-body {
    flex: 1;
}

/* ========================================
   Compact Progress Bar
   ======================================== */
.category-cards-grid-inline .category-card-progress {
    height: 7px;
    margin: 8px 0 4px;
    background: #e0e7ff;
    border-radius: 999px;
    overflow: hidden;
}

.category-cards-grid-inline .category-card-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    box-shadow: 0 0 12px rgba(102, 126, 234, 0.5);
}

/* ========================================
   Compact Card Footer
   ======================================== */
.category-cards-grid-inline .category-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px dashed rgba(148,163,184,0.4);
    margin-top: auto;
}

.category-cards-grid-inline .category-card-percentage {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #334155;
    font-weight: 600;
}

.category-cards-grid-inline .category-card-percentage i {
    color: #6366f1;
}

.category-cards-grid-inline .category-card-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6366f1;
    font-weight: 600;
    transition: transform 0.25s ease;
}

.category-cards-grid-inline .category-card-action i {
    font-size: 11px;
}

.category-cards-grid-inline .category-card:hover .category-card-action {
    transform: translateX(-4px);
}

.category-cards-grid-inline .category-card.active,
.category-cards-grid-inline .category-card.selected {
    border-color: rgba(79, 70, 229, 0.45);
    box-shadow: 0 32px 60px -32px rgba(79, 70, 229, 0.75);
    transform: translateY(-6px) scale(1.01);
}

.category-cards-grid-inline .category-card.active .category-card-count,
.category-cards-grid-inline .category-card.selected .category-card-count {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 16px 32px -20px rgba(22, 163, 74, 0.65);
}

.category-cards-grid-inline .category-card.active::after,
.category-cards-grid-inline .category-card.selected::after {
    background: radial-gradient(circle, rgba(34,197,94,0.22), transparent 60%);
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
    .category-type-buttons {
        overflow-x: auto;
        scrollbar-width: none;
    }

    .category-type-buttons::-webkit-scrollbar {
        display: none;
    }

    .category-cards-grid-inline {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    .category-cards-grid-inline[data-view="list"] {
        grid-template-columns: 1fr;
    }

    .category-cards-grid-inline .category-card {
        min-height: 150px;
        padding: 18px;
    }
}

/* ========================================
   Show All Cards Button
   ======================================== */
.show-all-cards-btn {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: rgba(255,255,255,0.92);
    color: #4338ca;
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 999px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 18px 30px -24px rgba(15, 23, 42, 0.55);
}

.show-all-cards-btn:hover {
    background: #4338ca;
    color: #ffffff;
    border-color: rgba(67, 56, 202, 0.4);
    box-shadow: 0 26px 40px -28px rgba(67, 56, 202, 0.55);
    transform: translateY(-2px);
}

.show-all-cards-btn.is-visible {
    display: inline-flex;
}

.show-all-cards-btn i {
    margin-left: 0;
}
