/**
 * PairMyPet Stud Dogs Embed Widget Styles
 * Polished card-based layout for stud dog listings
 */

.pm-embed-widget {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: #3d3a4a;
    box-sizing: border-box;
}

.pm-embed-widget *,
.pm-embed-widget *::before,
.pm-embed-widget *::after {
    box-sizing: inherit;
}

/* ===========================================
   LOADING / ERROR STATES
   =========================================== */

.pm-embed-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
}

.pm-embed-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #f3f1f8;
    border-top: 3px solid #ff5857;
    border-radius: 50%;
    animation: pm-spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes pm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.pm-embed-error,
.pm-embed-no-results {
    text-align: center;
    padding: 2rem 1rem;
    background: #f9f8fc;
    border-radius: 12px;
}

.pm-embed-error p,
.pm-embed-no-results p {
    margin: 0 0 1rem 0;
    color: #6b6879;
}

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

.pm-embed-filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.pm-embed-filter {
    flex: 1;
    min-width: 150px;
    padding: 0.75rem 1rem;
    border: 1px solid #e8e6ef;
    border-radius: 10px;
    background: white;
    font-family: inherit;
    font-size: 0.95rem;
    color: #3d3a4a;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6879' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pm-embed-filter:focus {
    outline: none;
    border-color: #ff5857;
    box-shadow: 0 0 0 3px rgba(255, 88, 87, 0.08);
}

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

.pm-embed-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

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

.pm-embed-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #eeedf3;
    box-shadow: 0 1px 4px rgba(26, 22, 37, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: inherit;
}

.pm-embed-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 88, 87, 0.18);
    box-shadow:
        0 8px 24px rgba(26, 22, 37, 0.08),
        0 2px 6px rgba(26, 22, 37, 0.04);
}

/* --- Image --- */

.pm-embed-card-image {
    position: relative;
    aspect-ratio: 5 / 4;
    overflow: hidden;
    background: #f3f1f8;
}

.pm-embed-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.pm-embed-card:hover .pm-embed-card-image img {
    transform: scale(1.05);
}

/* Fee overlay — bottom-right of image */
.pm-embed-card-fee-overlay {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    font-family: 'Quicksand', -apple-system, sans-serif;
    font-size: 0.8rem;
    font-weight: 800;
    color: #fff;
    background: rgba(26, 22, 37, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0.25rem 0.65rem;
    border-radius: 7px;
    letter-spacing: 0.01em;
    line-height: 1.3;
}

/* Premium badge — top-left of image */
.pm-embed-badge-premium {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: linear-gradient(135deg, #ff5857, #e80067);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 100px;
    font-family: 'Quicksand', sans-serif;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 8px rgba(255, 88, 87, 0.3);
}

/* --- Content area --- */

.pm-embed-card-content {
    padding: 0.75rem 0.875rem 0.875rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/*
 * Info block: name, breed+age, location
 * Designed as a tight cohesive unit — reads like:
 *   Sunny
 *   French Bulldog · 2 yrs
 *   📍 Frankfort, Kentucky
 */
.pm-embed-card-header {
    display: flex;
    flex-direction: column;
}

.pm-embed-card-name {
    margin: 0 0 0.3rem !important;
    font-family: 'Quicksand', -apple-system, sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1625;
    line-height: 1.25;
}

.pm-embed-card-subtitle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.3rem;
}

.pm-embed-card-breed {
    margin: 0;
    font-size: 0.8rem;
    color: #6b6879;
    line-height: 1.3;
}

.pm-embed-card-age {
    font-size: 0.7rem;
    color: #6b6879;
    font-weight: 600;
    background: #f0eef5;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
    line-height: 1.3;
}

.pm-embed-card-location {
    margin: 0;
    font-size: 0.78rem;
    color: #8a8797;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    line-height: 1.3;
}

.pm-embed-card-location::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a09dab' stroke-width='2'%3E%3Cpath d='M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z'%3E%3C/path%3E%3Ccircle cx='12' cy='10' r='3'%3E%3C/circle%3E%3C/svg%3E");
    background-size: contain;
    flex-shrink: 0;
}

/* --- Badges --- */

.pm-embed-card-badges {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 0.625rem;
}

.pm-embed-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.225rem 0.5rem;
    background: rgba(16, 185, 129, 0.07);
    color: #059669;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.675rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pm-embed-badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #10b981;
    flex-shrink: 0;
}

/* --- Legacy elements (hidden — replaced by overlay) --- */

.pm-embed-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    padding-top: 0.625rem;
    border-top: 1px solid #f0eef5;
}

.pm-embed-card-fee {
    font-family: 'Quicksand', -apple-system, sans-serif;
    font-size: 1rem;
    font-weight: 800;
    color: #1a1625;
}

.pm-embed-card-fee-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.7rem;
    color: #8a8797;
    font-weight: 500;
}

/* ===========================================
   CTA SECTION
   =========================================== */

.pm-embed-cta {
    text-align: center;
    padding: 1rem 0 0.5rem;
}

.pm-embed-count {
    margin: 0 0 1rem 0;
    font-size: 0.85rem;
    color: #6b6879;
}

.pm-embed-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border-radius: 12px;
    font-family: 'Quicksand', -apple-system, sans-serif;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
}

.pm-embed-btn-primary {
    background: linear-gradient(135deg, #ff5857, #e80067);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(255, 88, 87, 0.25);
}

.pm-embed-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 88, 87, 0.35);
}

.pm-embed-btn-primary svg {
    transition: transform 0.2s ease;
}

.pm-embed-btn-primary:hover svg {
    transform: translateX(4px);
}

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

@media (max-width: 900px) {
    .pm-embed-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 600px) {
    .pm-embed-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    /* Horizontal card on mobile */
    .pm-embed-card {
        flex-direction: row;
        border-radius: 12px;
    }

    .pm-embed-card-image {
        width: 120px;
        min-width: 120px;
        aspect-ratio: auto;
        height: auto;
    }

    .pm-embed-card-fee-overlay {
        bottom: 0.35rem;
        right: 0.35rem;
        font-size: 0.7rem;
        padding: 0.175rem 0.45rem;
        border-radius: 5px;
    }

    .pm-embed-card-content {
        padding: 0.625rem 0.75rem;
    }

    .pm-embed-card-name {
        font-size: 0.95rem;
    }

    .pm-embed-card-badges {
        padding-top: 0.375rem;
    }

    .pm-embed-badge {
        font-size: 0.6rem;
        padding: 0.15rem 0.4rem;
    }

    .pm-embed-filters {
        flex-direction: column;
    }

    .pm-embed-filter {
        width: 100%;
    }

    .pm-embed-btn {
        width: 100%;
    }
}

/* ===========================================
   DARK MODE
   =========================================== */

@media (prefers-color-scheme: dark) {
    .pm-embed-widget.pm-embed-dark {
        color: #e0e0e0;
    }

    .pm-embed-dark .pm-embed-card {
        background: #1e1e1e;
        border-color: #2a2a2a;
    }

    .pm-embed-dark .pm-embed-card-name {
        color: #fff;
    }

    .pm-embed-dark .pm-embed-card-breed,
    .pm-embed-dark .pm-embed-card-location,
    .pm-embed-dark .pm-embed-card-age {
        color: #aaa;
    }

    .pm-embed-dark .pm-embed-filter {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }

    .pm-embed-dark .pm-embed-error,
    .pm-embed-dark .pm-embed-no-results {
        background: #1e1e1e;
    }
}
