/**
 * Taxonomy Children Widget Styles
 * Modern, Clean & Minimal Design
 */

/* Container */
.psm-taxonomy-children-container {
    width: 100%;
    position: relative;
}

/* Grid Layout */
.psm-taxonomy-children-grid {
    display: grid;
    gap: 24px;
    width: 100%;
}

/* Card Base */
.psm-tax-child-card {
    position: relative;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e7e7e7;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.psm-tax-child-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.psm-tax-child-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

/* Image Container */
.psm-tax-child-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #ffffff;
}

.psm-tax-child-image img {
    padding-top: 10px;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Image Overlay */
.psm-tax-child-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.psm-tax-child-card:hover .psm-tax-child-image::after {
    opacity: 1;
}

/* Hover Effects */
.psm-hover-effect-zoom .psm-tax-child-card:hover .psm-tax-child-image img {
    transform: scale(1.1);
}

.psm-hover-effect-zoom-out .psm-tax-child-card:hover .psm-tax-child-image img {
    transform: scale(0.95);
}

.psm-hover-effect-slide .psm-tax-child-card:hover .psm-tax-child-image img {
    transform: translateY(-10px);
}

/* Content Area */
.psm-tax-child-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Title */
.psm-tax-child-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.psm-tax-child-card:hover .psm-tax-child-title {
    color: #3b82f6;
}

/* Product Count */
.psm-tax-child-count {
    margin-top: 8px;
    font-size: 14px;
    color: #6b7280;
    font-weight: 400;
}

/* Description */
.psm-tax-child-description {
    margin-top: 12px;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.6;
}

/* Empty State */
.psm-taxonomy-children-empty {
    padding: 60px 20px;
    text-align: center;
    color: #9ca3af;
    font-size: 16px;
}

/* Auto-Detect Notice */
.psm-auto-detect-notice {
    background: #e7f7ff;
    border-left: 4px solid #00a0d2;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: 14px;
}

/* Card Styles */

/* Modern Style */
.psm-tax-card-style-modern .psm-tax-child-card {
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.psm-tax-card-style-modern .psm-tax-child-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.psm-tax-card-style-modern .psm-tax-child-image {
    border-radius: 16px 16px 0 0;
}

/* Minimal Style */
.psm-tax-card-style-minimal .psm-tax-child-card {
    border: none;
    border-radius: 0;
    box-shadow: none;
    border-bottom: 2px solid #e7e7e7;
}

.psm-tax-card-style-minimal .psm-tax-child-card:hover {
    border-bottom-color: #3b82f6;
    transform: none;
    box-shadow: none;
}

.psm-tax-card-style-minimal .psm-tax-child-image {
    border-radius: 0;
}

.psm-tax-card-style-minimal .psm-tax-child-content {
    padding: 16px 0;
}

/* Elegant Style */
.psm-tax-card-style-elegant .psm-tax-child-card {
    border: 2px solid #e7e7e7;
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
}

.psm-tax-card-style-elegant .psm-tax-child-card:hover {
    border-color: #3b82f6;
    background: #ffffff;
}

.psm-tax-card-style-elegant .psm-tax-child-title {
    font-family: Georgia, serif;
    letter-spacing: 0.5px;
}

/* Creative Style */
.psm-tax-card-style-creative .psm-tax-child-card {
    border-radius: 24px 4px 24px 4px;
    border: none;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.08);
}

.psm-tax-card-style-creative .psm-tax-child-card:hover {
    box-shadow: 0 0 0 2px #3b82f6, 0 8px 24px rgba(59, 130, 246, 0.2);
}

.psm-tax-card-style-creative .psm-tax-child-image {
    border-radius: 24px 4px 0 0;
}

/* Luxury Style */
.psm-tax-card-style-luxury .psm-tax-child-card {
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.psm-tax-card-style-luxury .psm-tax-child-card:hover {
    border-color: #fbbf24;
    box-shadow: 0 4px 16px rgba(251, 191, 36, 0.2);
}

.psm-tax-card-style-luxury .psm-tax-child-title {
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 16px;
}

.psm-tax-card-style-luxury .psm-tax-child-content {
    padding: 24px;
    background: linear-gradient(to bottom, #ffffff 0%, #fafafa 100%);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .psm-taxonomy-children-grid {
        gap: 16px;
    }
    
    .psm-tax-child-image {
        height: 180px;
    }
    
    .psm-tax-child-content {
        padding: 16px;
    }
    
    .psm-tax-child-title {
        font-size: 16px;
    }
    
    .psm-tax-child-count,
    .psm-tax-child-description {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .psm-tax-child-image {
        height: 160px;
    }
    
    .psm-tax-child-content {
        padding: 12px;
    }
    
    .psm-tax-child-title {
        font-size: 15px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .psm-tax-child-card {
        background: #1f2937;
        border-color: #374151;
    }
    
    .psm-tax-child-title {
        color: #f9fafb;
    }
    
    .psm-tax-child-card:hover .psm-tax-child-title {
        color: #60a5fa;
    }
    
    .psm-tax-child-count,
    .psm-tax-child-description {
        color: #9ca3af;
    }
}

/* Loading State (Optional) */
.psm-tax-child-card.loading {
    pointer-events: none;
    opacity: 0.6;
}

.psm-tax-child-card.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: loading 1.5s infinite;
    z-index: 10;
}

@keyframes loading {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Accessibility */
.psm-tax-child-link:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.psm-tax-child-link:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .psm-tax-child-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #e7e7e7;
    }
    
    .psm-tax-child-card:hover {
        transform: none;
    }
}

/* ============================================
   LAYOUT TYPES - Advanced Layouts
   ============================================ */

/* 1. MASONRY GRID LAYOUT */
.psm-tax-layout-masonry .psm-taxonomy-children-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-auto-rows: 20px;
    gap: 20px;
}

.psm-tax-layout-masonry .psm-tax-child-card {
    grid-row-end: span 12;
    height: auto;
}

.psm-tax-layout-masonry .psm-tax-child-card:nth-child(3n+1) {
    grid-row-end: span 15;
}

.psm-tax-layout-masonry .psm-tax-child-card:nth-child(3n+2) {
    grid-row-end: span 10;
}

.psm-tax-layout-masonry .psm-tax-child-image {
    height: auto;
    min-height: 180px;
    max-height: 300px;
}

/* 2. TIMELINE LAYOUT */
.psm-tax-layout-timeline .psm-taxonomy-children-grid {
    display: block;
    position: relative;
    padding: 40px 0;
}

/* Timeline - Vertical */
.psm-tax-layout-timeline.psm-timeline-vertical .psm-taxonomy-children-grid::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, #3b82f6, #8b5cf6);
    transform: translateX(-50%);
}

.psm-tax-layout-timeline.psm-timeline-vertical .psm-tax-child-card {
    position: relative;
    width: calc(50% - 40px);
    margin-bottom: 40px;
    border-radius: 12px;
}

.psm-tax-layout-timeline.psm-timeline-vertical .psm-tax-child-card:nth-child(odd) {
    margin-left: 0;
    margin-right: auto;
    margin-left: 0;
}

.psm-tax-layout-timeline.psm-timeline-vertical .psm-tax-child-card:nth-child(even) {
    margin-left: auto;
    margin-right: 0;
}

.psm-tax-layout-timeline.psm-timeline-vertical .psm-tax-child-card::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: #3b82f6;
    border: 4px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 3px #3b82f6;
    top: 30px;
}

.psm-tax-layout-timeline.psm-timeline-vertical .psm-tax-child-card:nth-child(odd)::before {
    right: -50px;
}

.psm-tax-layout-timeline.psm-timeline-vertical .psm-tax-child-card:nth-child(even)::before {
    left: -50px;
}

/* Timeline - Horizontal */
.psm-tax-layout-timeline.psm-timeline-horizontal .psm-taxonomy-children-grid {
    display: flex;
    overflow-x: auto;
    padding-bottom: 60px;
    gap: 40px;
}

.psm-tax-layout-timeline.psm-timeline-horizontal .psm-taxonomy-children-grid::before {
    content: '';
    position: absolute;
    bottom: 30px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to right, #3b82f6, #8b5cf6);
}

.psm-tax-layout-timeline.psm-timeline-horizontal .psm-tax-child-card {
    flex: 0 0 300px;
    margin-bottom: 0;
}

.psm-tax-layout-timeline.psm-timeline-horizontal .psm-tax-child-card::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: #3b82f6;
    border: 4px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 3px #3b82f6;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
}

/* 3. HOVER TILES LAYOUT */
.psm-tax-layout-hover-tiles .psm-taxonomy-children-grid {
    display: grid;
    gap: 2px;
    background: #f3f4f6;
}

.psm-tax-layout-hover-tiles .psm-tax-child-card {
    border-radius: 0;
    border: none;
    position: relative;
    overflow: hidden;
    height: 300px;
}

.psm-tax-layout-hover-tiles .psm-tax-child-image {
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.psm-tax-layout-hover-tiles .psm-tax-child-image::after {
    opacity: 0.6;
    background: linear-gradient(to bottom, rgba(0,0,0,0.2), rgba(0,0,0,0.8));
}

.psm-tax-layout-hover-tiles .psm-tax-child-card:hover .psm-tax-child-image::after {
    opacity: 0.4;
}

.psm-tax-layout-hover-tiles .psm-tax-child-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px;
    background: transparent;
    z-index: 2;
}

.psm-tax-layout-hover-tiles .psm-tax-child-title {
    color: #ffffff;
    font-size: 24px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.psm-tax-layout-hover-tiles .psm-tax-child-count {
    color: rgba(255,255,255,0.9);
}

.psm-tax-layout-hover-tiles .psm-tax-child-card:hover {
    transform: scale(1.02);
    z-index: 10;
}

/* 4. ACCORDION LAYOUT */
.psm-tax-layout-accordion .psm-taxonomy-children-grid {
    display: block;
}

.psm-tax-layout-accordion .psm-tax-child-card {
    margin-bottom: 8px;
    border-radius: 8px;
    overflow: hidden;
    height: 80px;
    transition: height 0.3s ease;
}

.psm-tax-layout-accordion .psm-tax-child-link {
    flex-direction: row;
    align-items: center;
}

.psm-tax-layout-accordion .psm-tax-child-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.psm-tax-layout-accordion .psm-tax-child-content {
    padding: 16px 20px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.psm-tax-layout-accordion .psm-tax-child-description {
    display: none;
    margin-top: 12px;
}

.psm-tax-layout-accordion .psm-tax-child-card.active {
    height: auto;
    min-height: 200px;
}

.psm-tax-layout-accordion .psm-tax-child-card.active .psm-tax-child-link {
    flex-direction: column;
    align-items: stretch;
}

.psm-tax-layout-accordion .psm-tax-child-card.active .psm-tax-child-image {
    width: 100%;
    height: 200px;
}

.psm-tax-layout-accordion .psm-tax-child-card.active .psm-tax-child-content {
    flex-direction: column;
    align-items: flex-start;
}

.psm-tax-layout-accordion .psm-tax-child-card.active .psm-tax-child-description {
    display: block;
}

/* Accordion Arrow */
.psm-tax-layout-accordion .psm-tax-child-content::after {
    content: '▼';
    font-size: 12px;
    color: #6b7280;
    transition: transform 0.3s ease;
}

.psm-tax-layout-accordion .psm-tax-child-card.active .psm-tax-child-content::after {
    transform: rotate(180deg);
}

/* 5. SPLIT SCREEN LAYOUT */
.psm-tax-layout-split-screen .psm-taxonomy-children-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 500px;
}

.psm-tax-layout-split-screen .psm-tax-child-card {
    border-radius: 0;
    border: none;
    height: 100%;
    min-height: 500px;
}

.psm-tax-layout-split-screen .psm-tax-child-card:hover {
    transform: scale(1.05);
    z-index: 10;
}

.psm-tax-layout-split-screen .psm-tax-child-image {
    height: 60%;
}

.psm-tax-layout-split-screen .psm-tax-child-content {
    height: 40%;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.psm-tax-layout-split-screen .psm-tax-child-title {
    font-size: 32px;
    margin-bottom: 16px;
}

/* 6. CAROUSEL/SLIDER LAYOUT */
.psm-tax-layout-carousel .psm-taxonomy-children-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 20px;
    padding-bottom: 20px;
    scrollbar-width: thin;
}

.psm-tax-layout-carousel .psm-taxonomy-children-grid::-webkit-scrollbar {
    height: 8px;
}

.psm-tax-layout-carousel .psm-taxonomy-children-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.psm-tax-layout-carousel .psm-taxonomy-children-grid::-webkit-scrollbar-thumb {
    background: #3b82f6;
    border-radius: 10px;
}

.psm-tax-layout-carousel .psm-tax-child-card {
    flex: 0 0 350px;
    scroll-snap-align: start;
}

/* 7. ICON GRID LAYOUT */
.psm-tax-layout-icon-grid .psm-taxonomy-children-grid {
    display: grid;
    gap: 16px;
}

.psm-tax-layout-icon-grid .psm-tax-child-card {
    height: auto;
    border-radius: 12px;
    text-align: center;
    padding: 30px 20px;
    background: #fafafa;
    border: 2px dashed #e7e7e7;
}

.psm-tax-layout-icon-grid .psm-tax-child-link {
    flex-direction: column;
    align-items: center;
}

.psm-tax-layout-icon-grid .psm-tax-child-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 20px;
    border: 4px solid #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.psm-tax-layout-icon-grid .psm-tax-child-content {
    padding: 0;
}

.psm-tax-layout-icon-grid .psm-tax-child-card:hover {
    background: #ffffff;
    border-color: #3b82f6;
    border-style: solid;
}

.psm-tax-layout-icon-grid .psm-tax-child-card:hover .psm-tax-child-image {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

/* 8. MAGAZINE LAYOUT */
.psm-tax-layout-magazine .psm-taxonomy-children-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 200px;
    gap: 16px;
}

.psm-tax-layout-magazine .psm-tax-child-card:first-child {
    grid-column: 1 / 3;
    grid-row: 1 / 3;
}

.psm-tax-layout-magazine .psm-tax-child-card:nth-child(2) {
    grid-column: 3 / 5;
    grid-row: 1 / 2;
}

.psm-tax-layout-magazine .psm-tax-child-card:nth-child(3) {
    grid-column: 3 / 4;
    grid-row: 2 / 3;
}

.psm-tax-layout-magazine .psm-tax-child-card:nth-child(4) {
    grid-column: 4 / 5;
    grid-row: 2 / 3;
}

.psm-tax-layout-magazine .psm-tax-child-card {
    position: relative;
    height: 100%;
}

.psm-tax-layout-magazine .psm-tax-child-image {
    height: 100%;
}

.psm-tax-layout-magazine .psm-tax-child-image::after {
    opacity: 0.5;
    background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.8));
}

.psm-tax-layout-magazine .psm-tax-child-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px;
    background: transparent;
    z-index: 2;
}

.psm-tax-layout-magazine .psm-tax-child-title {
    color: #ffffff;
    font-size: 20px;
}

.psm-tax-layout-magazine .psm-tax-child-card:first-child .psm-tax-child-title {
    font-size: 32px;
}

.psm-tax-layout-magazine .psm-tax-child-count {
    color: rgba(255,255,255,0.9);
}

/* Responsive for Advanced Layouts */
@media (max-width: 1024px) {
    .psm-tax-layout-timeline.psm-timeline-vertical .psm-taxonomy-children-grid::before {
        left: 30px;
    }
    
    .psm-tax-layout-timeline.psm-timeline-vertical .psm-tax-child-card {
        width: calc(100% - 60px);
        margin-left: 60px !important;
    }
    
    .psm-tax-layout-timeline.psm-timeline-vertical .psm-tax-child-card::before {
        left: -50px !important;
    }
    
    .psm-tax-layout-split-screen .psm-taxonomy-children-grid {
        grid-template-columns: 1fr;
    }
    
    .psm-tax-layout-magazine .psm-taxonomy-children-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .psm-tax-layout-magazine .psm-tax-child-card:first-child {
        grid-column: 1 / 3;
    }
    
    .psm-tax-layout-magazine .psm-tax-child-card:nth-child(2),
    .psm-tax-layout-magazine .psm-tax-child-card:nth-child(3),
    .psm-tax-layout-magazine .psm-tax-child-card:nth-child(4) {
        grid-column: auto;
        grid-row: auto;
    }
}

@media (max-width: 768px) {
    .psm-tax-layout-hover-tiles .psm-tax-child-card {
        height: 200px;
    }
    
    .psm-tax-layout-carousel .psm-tax-child-card {
        flex: 0 0 280px;
    }
    
    .psm-tax-layout-icon-grid .psm-tax-child-image {
        width: 60px;
        height: 60px;
    }
}
