/* ============================================
   RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
    background: white !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #111;
    line-height: 1.5;
    padding-bottom: 0px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   VARIABLES
   ============================================ */
:root {
    --orange: #f97316;
    --orange-dark: #ea580c;
    --orange-light: #ffedd5;
    --white: #fff;
    --black: #111;
    --gray-100: #f5f5f5;
    --gray-200: #e5e5e5;
    --gray-300: #d4d4d4;
    --gray-400: #a3a3a3;
    --gray-500: #737373;
    --gray-600: #525252;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-orange: 0 4px 14px rgba(249, 115, 22, 0.3);
    --radius-banner: 5px;
    --radius-card: 14px;
    --radius-sm: 8px;
    --radius-full: 50%;
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   CATEGORY HEADER - Professional Banner
   ============================================ */

.category-header {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    padding: 20px 16px;
    min-height: auto;
    display: flex;
    align-items: center;
    margin: 8px;
    border-radius: var(--radius-banner);
    box-shadow: 0 4px 16px rgba(249, 115, 22, 0.25);
    position: relative;
    overflow: hidden;
}

/* Subtle pattern overlay */
.category-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 80%, rgba(255,255,255,0.08) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255,255,255,0.06) 0%, transparent 50%);
    pointer-events: none;
}

.category-header-content {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    position: relative;
    z-index: 1;
    padding: 0 4px;
}

.category-header-content > div:first-child {
    flex: 1;
    min-width: 0;
}

.category-header-content h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.4px;
    line-height: 1.25;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-header-content h1 i {
    font-size: 18px;
    opacity: 0.9;
}

.category-header-content p {
    margin: 6px 0 0;
    opacity: 0.9;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.45;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.category-stats {
    padding: 5px 14px;
    font-weight: 700;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    backdrop-filter: blur(6px);
    white-space: nowrap;
    flex-shrink: 0;
}

.category-stats i {
    font-size: 12px;
    opacity: 0.9;
}

/* ============================================
   MAIN CONTAINER
   ============================================ */

.main-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 4px 12px 20px;
    overflow-x: hidden;
}

/* ============================================
   BREADCRUMB - Hidden
   ============================================ */

.breadcrumb {
    display: none !important;
}

/* ============================================
   SECTION HEADER
   ============================================ */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding: 0 2px;
}

.section-header h2 {
    margin: 0;
    font-size: 16px;
    color: #111;
    font-weight: 800;
    letter-spacing: -0.2px;
}

.section-header h2 i {
    color: var(--orange);
    margin-right: 7px;
    font-size: 15px;
}

.count-badge {
    background: linear-gradient(135deg, var(--orange), var(--orange-dark));
    color: white;
    padding: 3px 12px;
    font-size: 11px;
    border-radius: 20px;
    font-weight: 700;
    letter-spacing: 0.2px;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
}

/* ============================================
   SUBCATEGORIES SECTION
   ============================================ */

.subcategories-section {
    margin-top: 0;
    margin-bottom: 16px;
    padding: 0;
    background: transparent;
    overflow-x: hidden;
}

/* ============================================
   SUBCATEGORIES GRID - 4 Columns on Mobile
   ============================================ */

.subcategories-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

/* ============================================
   SUBCATEGORY CARD - Professional Style
   ============================================ */

.subcategory-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    background: var(--white);
    border-radius: var(--radius-card);
    padding: 14px 6px 12px;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.subcategory-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, var(--orange), var(--orange-dark));
    border-radius: 2px;
    transition: transform var(--transition-base);
}

.subcategory-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--orange-light);
}

.subcategory-card:hover::after {
    transform: translateX(-50%) scaleX(1);
}

.subcategory-card:active {
    transform: scale(0.96);
    border-color: var(--orange);
}

.subcategory-image {
    width: 64px;
    height: 64px;
    overflow: hidden;
    flex-shrink: 0;
    margin: 0 auto 8px;
    background: linear-gradient(135deg, #f8f9fa, #f0f0f0);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    transition: border-color var(--transition-base);
}

.subcategory-card:hover .subcategory-image {
    border-color: var(--orange-light);
}

.subcategory-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.subcategory-image .no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f8f9fa, #f0f0f0);
    color: var(--gray-400);
    font-size: 22px;
}

.subcategory-info {
    padding: 0;
    text-align: center;
    width: 100%;
}

.subcategory-info h3 {
    margin: 0 0 3px;
    font-size: 11px;
    color: var(--black);
    font-weight: 700;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 28px;
    letter-spacing: -0.1px;
    transition: color var(--transition-fast);
}

.subcategory-card:hover .subcategory-info h3 {
    color: var(--orange);
}

.subcategory-info span {
    font-size: 9px;
    color: var(--gray-500);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 10px;
}

.subcategory-info span i {
    font-size: 8px;
    color: var(--orange);
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
    text-align: center;
    padding: 50px 24px;
    background: var(--white);
    border-radius: var(--radius-card);
    border: 1px solid var(--gray-200);
    margin: 10px 0;
    grid-column: 1 / -1;
    box-shadow: var(--shadow-sm);
}

.empty-state i {
    font-size: 48px;
    color: var(--gray-300);
    margin-bottom: 14px;
    display: block;
}

.empty-state h3 {
    font-size: 16px;
    color: var(--black);
    margin-bottom: 6px;
    font-weight: 700;
}

.empty-state p {
    color: var(--gray-500);
    font-size: 13px;
    margin-bottom: 18px;
    line-height: 1.5;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--orange), var(--orange-dark));
    color: white;
    padding: 10px 24px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 4px 14px rgba(249, 115, 22, 0.35);
    letter-spacing: 0.2px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(249, 115, 22, 0.45);
}

.btn-primary:active {
    opacity: 0.9;
    transform: translateY(0) scale(0.97);
}

.btn-primary i {
    font-size: 13px;
}

/* ============================================
   RESPONSIVE - LARGER SCREENS
   ============================================ */

@media (min-width: 576px) {
    .category-header {
        margin: 10px;
        padding: 24px 24px;
        border-radius: var(--radius-banner);
    }

    .category-header-content h1 {
        font-size: 24px;
    }

    .category-header-content p {
        font-size: 14px;
    }

    .subcategories-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 14px;
    }

    .subcategory-card {
        padding: 16px 10px 14px;
        border-radius: 16px;
    }

    .subcategory-image {
        width: 80px;
        height: 80px;
        margin-bottom: 10px;
    }

    .subcategory-info h3 {
        font-size: 13px;
        min-height: 32px;
    }

    .subcategory-info span {
        font-size: 10px;
        padding: 3px 10px;
    }

    .main-container {
        padding: 8px 16px 24px;
        max-width: 1200px;
        margin: 0 auto;
    }

    .section-header h2 {
        font-size: 18px;
    }
}

@media (min-width: 768px) {
    .category-header {
        margin: 12px auto;
        max-width: 1200px;
        padding: 28px 32px;
    }

    .subcategories-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 16px;
    }

    .subcategory-card {
        padding: 18px 10px 16px;
    }

    .subcategory-image {
        width: 90px;
        height: 90px;
    }

    .subcategory-info h3 {
        font-size: 14px;
        min-height: 36px;
    }
}

@media (min-width: 1024px) {
    .category-header {
        padding: 32px 40px;
    }

    .category-header-content h1 {
        font-size: 28px;
    }

    .subcategories-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 18px;
    }

    .subcategory-card {
        padding: 20px 12px 18px;
        border-radius: 18px;
    }

    .subcategory-image {
        width: 100px;
        height: 100px;
        border-radius: 16px;
    }

    .subcategory-info h3 {
        font-size: 15px;
    }

    .subcategory-info span {
        font-size: 11px;
    }
}

/* ============================================
   RESPONSIVE - SMALL MOBILE (below 480px)
   ============================================ */

@media (max-width: 480px) {
    .category-header {
        margin: 6px;
        padding: 16px 14px;
        border-radius: var(--radius-banner);
    }

    .category-header-content h1 {
        font-size: 17px;
        gap: 6px;
    }

    .category-header-content h1 i {
        font-size: 15px;
    }

    .category-header-content p {
        font-size: 12px;
        margin-top: 4px;
    }

    .category-stats {
        font-size: 11px;
        padding: 4px 10px;
    }

    .main-container {
        padding: 2px 10px 16px;
    }

    .subcategories-grid {
        gap: 8px;
    }

    .subcategory-card {
        padding: 12px 5px 10px;
        border-radius: 12px;
    }

    .subcategory-image {
        width: 56px;
        height: 56px;
        margin-bottom: 6px;
        border-radius: 10px;
    }

    .subcategory-info h3 {
        font-size: 10px;
        min-height: 24px;
        font-weight: 600;
    }

    .subcategory-info span {
        font-size: 8px;
        padding: 1px 6px;
    }

    .section-header h2 {
        font-size: 14px;
    }

    .count-badge {
        font-size: 10px;
        padding: 2px 10px;
    }
}

/* ============================================
   RESPONSIVE - VERY SMALL (below 380px)
   ============================================ */

@media (max-width: 380px) {
    .category-header {
        margin: 4px;
        padding: 14px 12px;
        border-radius: var(--radius-banner);
    }

    .category-header-content h1 {
        font-size: 15px;
    }

    .subcategories-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .subcategory-card {
        padding: 10px 4px 8px;
        border-radius: 10px;
    }

    .subcategory-image {
        width: 50px;
        height: 50px;
        border-radius: 8px;
    }

    .subcategory-info h3 {
        font-size: 9px;
        min-height: 20px;
    }

    .subcategory-info span {
        font-size: 7px;
        padding: 1px 5px;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    .subcategory-card:hover {
        transform: none !important;
        box-shadow: var(--shadow-sm) !important;
        border-color: var(--gray-200) !important;
    }

    .subcategory-card:hover::after {
        transform: translateX(-50%) scaleX(0) !important;
    }

    .subcategory-card:active {
        transform: scale(0.96) !important;
        border-color: var(--orange) !important;
        box-shadow: 0 2px 8px rgba(249, 115, 22, 0.15) !important;
    }

    .subcategory-card:active .subcategory-info h3 {
        color: var(--orange) !important;
    }

    .btn-primary:hover {
        transform: none !important;
        box-shadow: 0 4px 14px rgba(249, 115, 22, 0.35) !important;
    }

    .btn-primary:active {
        transform: scale(0.97) !important;
    }

    .category-header:hover {
        box-shadow: 0 4px 16px rgba(249, 115, 22, 0.25) !important;
    }
}

/* ============================================
   UTILITY
   ============================================ */

.text-center {
    text-align: center;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Hide scrollbars globally */
::-webkit-scrollbar {
    width: 0;
    height: 0;
    background: transparent;
    display: none;
}

* {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

::selection {
    background: var(--orange);
    color: white;
}

/* ============================================
   SAFE AREA (Notch phones)
   ============================================ */

@supports (padding: env(safe-area-inset-bottom)) {
    body {
        padding-bottom: calc(75px + env(safe-area-inset-bottom));
    }

    .category-header {
        margin-top: calc(6px + env(safe-area-inset-top));
    }
}