/**
 * DirectoryV6.css — Beauty Navigator Directory Module
 *
 * Sections:
 *   1. Theme tokens   – override Bootstrap 5 --bs-primary with #419bc0
 *   2. Loading bar    – top-of-module progress indicator
 *   3. Shared         – page title, toolbar
 *   4. Mode 1 (Browse) — category card grid
 *   5. Mode 2 (List)  — list header, search, company cards
 *   6. Pagination
 *   7. Offcanvas drawers — Filters + Categories
 *   8. Skeleton placeholders
 *   9. Responsive overrides
 *
 * Global classes already defined in beautynavigator-custom-css.css
 * (do NOT redefine here):
 *   .company-viewed-today  — "viewed today" card border highlight
 *   .disabled-card         — pointer-events: none; opacity: 0.5
 */

/* ═══════════════════════════════════════════════════════════════════════════
   1. Theme tokens — primary color #419bc0
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
    --bs-primary:       #419bc0;
    --bs-primary-rgb:   65, 155, 192;
    --bn-primary-hover: #3788aa;
    --bn-card-radius:   0.5rem;
    --bn-card-shadow:   0 1px 4px rgba(0, 0, 0, .08);
    --bn-card-shadow-hover: 0 4px 12px rgba(65, 155, 192, .20);
    --bn-transition:    0.18s ease;
}

/* Bootstrap btn-primary and links inherit the token automatically.
   Manually ensure btn-primary uses the overridden color where Bootstrap
   computes it from the variable at component level. */
.btn-primary {
    background-color: var(--bs-primary);
    border-color:     var(--bs-primary);
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--bn-primary-hover) !important;
    border-color:     var(--bn-primary-hover) !important;
}
.btn-outline-primary {
    color:        var(--bs-primary);
    border-color: var(--bs-primary);
}
.btn-outline-primary:hover {
    background-color: var(--bs-primary);
    border-color:     var(--bs-primary);
}
.text-primary { color: var(--bs-primary) !important; }
.border-primary { border-color: var(--bs-primary) !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   2. Loading bar — thin animated bar at the top of the module
   ═══════════════════════════════════════════════════════════════════════════ */
.bn-directory {
    position:      relative;
    padding-left:  35px;
    padding-right: 35px;
}

.bn-loading-bar {
    position:        absolute;
    top:             0;
    left:            0;
    width:           0;
    height:          3px;
    background:      var(--bs-primary);
    border-radius:   0 2px 2px 0;
    transition:      width 0.3s ease, opacity 0.3s ease;
    opacity:         0;
    z-index:         10;
    pointer-events:  none;
}
.bn-loading-bar.bn-loading-active {
    opacity: 1;
    animation: bn-loading-pulse 1.4s ease infinite;
}
@keyframes bn-loading-pulse {
    0%   { width: 5%; }
    50%  { width: 75%; }
    100% { width: 90%; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   3. Shared — page title, toolbar
   ═══════════════════════════════════════════════════════════════════════════ */
.bn-page-title {
    font-weight: 600;
    color:       #2c3e50;
    line-height: 1.2;
}

.bn-toolbar {
    min-height: 38px;
}

.bn-sort-select {
    max-width: 160px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   4. Mode 1 — category card grid
   ═══════════════════════════════════════════════════════════════════════════ */
.bn-browse-header {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 1rem;
}

.bn-category-card {
    border-radius:  var(--bn-card-radius);
    box-shadow:     var(--bn-card-shadow);
    border:         1px solid #e8edf2;
    transition:     box-shadow var(--bn-transition), transform var(--bn-transition),
                    border-color var(--bn-transition);
    cursor:         pointer;
}
.bn-category-card:hover {
    box-shadow:     var(--bn-card-shadow-hover);
    transform:      translateY(-2px);
    border-color:   var(--bs-primary);
}

.bn-cat-icon {
    width:      40px;
    height:     40px;
    object-fit: contain;
    flex-shrink: 0;
}
.bn-cat-icon-placeholder {
    font-size:  1.5rem;
    flex-shrink: 0;
    width:       40px;
    text-align:  center;
}
.bn-cat-name {
    font-size:   0.9rem;
    font-weight: 600;
    line-height: 1.3;
}

/* ═══════════════════════════════════════════════════════════════════════════
   5. Mode 2 — list header, search bar, company cards
   ═══════════════════════════════════════════════════════════════════════════ */

/* List mode header bar */
.bn-list-header {
    border-bottom:  1px solid #e9ecef;
    padding-bottom: 0.75rem;
}
.bn-list-header .bn-page-title {
    font-size: 1.25rem;
}

/* Search bar — merge the icon and input visually */
.bn-mode-list .input-group .input-group-text {
    border-right: none;
}
.bn-mode-list .input-group .form-control {
    border-left:   none;
    box-shadow:    none;
}
.bn-mode-list .input-group .form-control:focus {
    border-color:  var(--bs-primary);
    outline:       none;
}
.bn-mode-list .input-group:focus-within .input-group-text {
    border-color:  var(--bs-primary);
}

/* Company card */
.bn-company-card {
    border-radius:  var(--bn-card-radius);
    box-shadow:     var(--bn-card-shadow);
    border:         1px solid #e8edf2;
    transition:     box-shadow var(--bn-transition), transform var(--bn-transition),
                    border-color var(--bn-transition);
}
.bn-company-card:hover {
    box-shadow:   var(--bn-card-shadow-hover);
    transform:    translateY(-2px);
    border-color: var(--bs-primary);
}

.bn-company-logo-wrap {
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bn-company-logo {
    max-height:  52px;
    max-width:   100%;
    object-fit:  contain;
}

.bn-company-name {
    font-size:   0.875rem;
    font-weight: 600;
    line-height: 1.3;
    /* Clamp to 2 lines to keep card heights uniform */
    display:           -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow:           hidden;
}

.bn-brands-text {
    font-size:         0.75rem;
    /* Clamp brand list to 1 line */
    display:           -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow:           hidden;
}

/* ═══════════════════════════════════════════════════════════════════════════
   6. Pagination
   ═══════════════════════════════════════════════════════════════════════════ */
.pagination .page-link {
    color:        var(--bs-primary);
    border-color: #dee2e6;
}
.pagination .page-item.active .page-link {
    background-color: var(--bs-primary);
    border-color:     var(--bs-primary);
    color:            #fff;
}
.pagination .page-link:hover {
    color:            var(--bn-primary-hover);
    background-color: #f0f8fc;
    border-color:     var(--bs-primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   7. Offcanvas drawers — Filters + Categories
   ═══════════════════════════════════════════════════════════════════════════ */

/* Both drawers share a comfortable fixed width */
#filtersDrawer,
#categoriesDrawer {
    width:     320px;
    max-width: 90vw;
}

/* Scrollable country list inside the Filters drawer */
.bn-country-list {
    max-height:   260px;
    overflow-y:   auto;
    border:       1px solid #dee2e6;
    border-radius: 0.375rem;
    padding:       0.5rem 0.75rem;
}
.bn-country-list .form-check {
    margin-bottom: 0.35rem;
}
.bn-country-list .form-check:last-child {
    margin-bottom: 0;
}

/* Scrollable category list inside the Categories drawer */
.bn-cat-drawer-list {
    max-height:  calc(100vh - 220px);
    overflow-y:  auto;
}
.bn-cat-drawer-list .list-group-item {
    border-left:  none;
    border-right: none;
    font-size:    0.875rem;
}
.bn-cat-drawer-list .list-group-item.active {
    background-color: var(--bs-primary);
    border-color:     var(--bs-primary);
}
.bn-cat-drawer-list .list-group-item:hover:not(.active):not(.disabled) {
    background-color: #f0f8fc;
    color:            var(--bs-primary);
}

/* Category icon in the drawer */
.bn-drawer-cat-icon {
    width:      24px;
    height:     24px;
    object-fit: contain;
    flex-shrink: 0;
}
.bn-cat-drawer-list .list-group-item.active .bn-drawer-cat-icon {
    filter: brightness(0) invert(1);
}
.bn-drawer-cat-icon-placeholder {
    width:      24px;
    font-size:  1rem;
    text-align: center;
    flex-shrink: 0;
}

/* Disabled state inside drawers — visible but greyed */
.bn-disabled-check {
    opacity: 0.55;
}

/* Offcanvas header consistent styling */
.offcanvas-header {
    background-color: #f8f9fa;
}

/* ═══════════════════════════════════════════════════════════════════════════
   8. Skeleton / loading placeholders
   ═══════════════════════════════════════════════════════════════════════════ */
.bn-skeleton-card {
    background: #f4f6f8;
    border:     1px solid #e8edf2;
    border-radius: var(--bn-card-radius);
    min-height: 90px;
}

.bn-skeleton {
    background:      linear-gradient(90deg, #e8ecef 25%, #f4f6f8 50%, #e8ecef 75%);
    background-size: 200% 100%;
    animation:       bn-shimmer 1.4s ease infinite;
    border-radius:   4px;
}

.bn-skeleton-icon {
    width:  40px;
    height: 40px;
    border-radius: 6px;
    flex-shrink: 0;
}
.bn-skeleton-text {
    height: 16px;
    border-radius: 4px;
}
.bn-skeleton-text-sm {
    height: 12px;
    border-radius: 4px;
}
.bn-skeleton-logo {
    width:  60px;
    height: 52px;
    margin: 0 auto;
    border-radius: 6px;
}

@keyframes bn-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   9. Responsive overrides
   ═══════════════════════════════════════════════════════════════════════════ */

/* Reduce side padding on tablet */
@media (max-width: 768px) {
    .bn-directory {
        padding-left:  20px;
        padding-right: 20px;
    }
}

/* Reduce further on mobile */
@media (max-width: 480px) {
    .bn-directory {
        padding-left:  12px;
        padding-right: 12px;
    }
}

/* Stack toolbar items on very small screens */
@media (max-width: 480px) {
    .bn-toolbar {
        gap: 0.5rem !important;
    }
    .bn-sort-select {
        max-width: 140px;
    }
    .bn-list-header .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* Tighten category card padding on mobile */
@media (max-width: 576px) {
    .bn-category-card .card-body {
        padding: 0.65rem 0.75rem;
    }
    .bn-company-card .card-body {
        padding: 0.65rem 0.75rem;
    }
}
