/**
 * Directory Structure CSS
 *
 * STRUCTURE ONLY - no colors, shadows, radius, fonts, transitions.
 * All visual design in niche-*.css
 *
 * @package WD_Directory
 */

/* ========================================
   BASE RESET FOR PLUGIN SCOPE
   ======================================== */

#wd-app {
    box-sizing: border-box;
}

#wd-app *,
#wd-app *::before,
#wd-app *::after {
    box-sizing: inherit;
}

#wd-app img {
    max-width: 100%;
    height: auto;
}

/* ========================================
   CATEGORIES GRID
   ======================================== */

.wd-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--wd-spacing-md, 24px);
}

.wd-categories__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
}

.wd-categories__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
}

.wd-categories__name {
    display: block;
    text-align: center;
}

.wd-categories__count {
    display: block;
    text-align: center;
}

/* ========================================
   FILTERS
   ======================================== */

.wd-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--wd-spacing-sm, 12px);
    align-items: center;
}

.wd-filters select,
.wd-filters input {
    padding: 10px 16px;
    min-width: 160px;
}

.wd-filters__search {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

/* ========================================
   LISTINGS HEADER
   ======================================== */

.wd-listings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--wd-spacing-md, 24px) 0;
}

.wd-results-count {
    display: block;
}

/* ========================================
   LISTINGS GRID
   ======================================== */

.wd-listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--wd-spacing-md, 24px);
}

.wd-listings-grid--loading {
    opacity: 0.6;
    pointer-events: none;
}

.wd-listings-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--wd-spacing-lg, 48px);
}

/* ========================================
   CARD
   ======================================== */

.wd-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.wd-card__image {
    aspect-ratio: 1 / var(--wd-card-image-ratio, 1.2);
    overflow: hidden;
    position: relative;
}

.wd-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wd-card__badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1;
}

.wd-card__favorite {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1;
    padding: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
}

.wd-card__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--wd-spacing-xs, 8px);
    padding: var(--wd-spacing-md, 24px);
}

.wd-card__title {
    margin: 0;
}

.wd-card__title a {
    text-decoration: none;
}

.wd-card__tagline {
    margin: 0;
}

.wd-card__meta {
    display: flex;
    gap: var(--wd-spacing-sm, 12px);
    flex-wrap: wrap;
}

.wd-card__phone {
    margin-top: auto;
    display: inline-block;
}

/* ========================================
   LISTING DETAIL
   ======================================== */

.wd-detail {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: var(--wd-spacing-lg, 48px);
}

.wd-detail__gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.wd-detail__gallery img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.wd-detail__gallery img:first-child {
    grid-column: 1 / -1;
    height: 320px;
}

.wd-detail__info {
    display: flex;
    flex-direction: column;
    gap: var(--wd-spacing-md, 24px);
}

.wd-detail__title {
    margin: 0;
}

.wd-detail__tagline {
    margin: 0;
}

.wd-detail__meta {
    display: flex;
    gap: var(--wd-spacing-sm, 12px);
    flex-wrap: wrap;
}

.wd-detail__section {
    margin-top: var(--wd-spacing-md, 24px);
}

.wd-detail__section-title {
    margin: 0 0 var(--wd-spacing-sm, 12px);
}

.wd-detail__description {
    margin: 0;
}

.wd-detail__description p:first-child {
    margin-top: 0;
}

.wd-detail__description p:last-child {
    margin-bottom: 0;
}

.wd-detail__social {
    display: flex;
    gap: var(--wd-spacing-md, 24px);
}

.wd-detail__favorite {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    cursor: pointer;
}

/* ========================================
   PAGINATION
   ======================================== */

.wd-pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    padding: var(--wd-spacing-lg, 48px) 0;
}

.wd-pagination__btn {
    padding: 8px 14px;
    border: none;
    cursor: pointer;
}

.wd-pagination__ellipsis {
    padding: 8px;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .wd-detail {
        grid-template-columns: 1fr;
    }

    .wd-detail__gallery img:first-child {
        height: 240px;
    }

    .wd-detail__gallery img {
        height: 150px;
    }

    .wd-listings-grid {
        grid-template-columns: 1fr 1fr;
    }

    .wd-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .wd-filters select,
    .wd-filters input {
        width: 100%;
        max-width: none;
    }

    .wd-filters__search {
        max-width: none;
    }
}

@media (max-width: 480px) {
    .wd-listings-grid {
        grid-template-columns: 1fr;
    }

    .wd-categories {
        grid-template-columns: repeat(2, 1fr);
    }
}
