@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap');

.ctdv2-container {
    display: grid !important;
    grid-template-columns: repeat(var(--grid-cols, 4), minmax(0, max-content)) !important;
    justify-content: center;
    align-content: start;
    justify-items: center;
    margin: 0 auto;
    padding: 25px 20px;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    width: 100%;
}

/* Category item transparent wrapper */
.ctdv2-category-item {
    position: relative;
    overflow: visible; /* To allow stacked pages to overflow */
    width: 260px;
    height: 130px; /* Premium tall card size */
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    font-family: 'Outfit', sans-serif;
    box-sizing: border-box;
    z-index: 3;
}

/* Clickable front card container */
.ctdv2-card-front {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    overflow: hidden; /* Paint blob is spreaded only on Front card */
    background: var(--card-bg, #ffffff) !important;
    border: 1px solid var(--card-border, rgba(255, 77, 109, 0.15)) !important;
    border-radius: 10px !important;
    box-shadow: 
        0 4px 10px rgba(0, 0, 0, 0.015),
        0 1px 2px rgba(0, 0, 0, 0.005);
        
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    box-sizing: border-box;
    padding: 42px 16px 14px 16px !important; /* Slightly higher title positioning */
}

/* Stacked Pages effect (Exact SVG offset mappings) */
.ctdv2-card-stack {
    position: absolute;
    border-radius: 10px !important;
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    bottom: 0 !important; /* Force bottom flush to prevent overflow outlines below the main card */
}

/* Stack 1 (Rect 3 in SVG): Same size as front card, medium light green color, opacity 0.6. Offset: top: -7px, left: -3px, right: 3px */
.ctdv2-card-stack-1 {
    top: -7px;
    left: -3px;
    right: 3px;
    background-color: var(--card-bg-stack-1, #fafafa) !important;
    border: 1px solid var(--card-border-stacked, rgba(255, 77, 109, 0.22)) !important;
    z-index: -1;
}

/* Stack 2 (Rect 2 in SVG): Narrower width, darkest color, low opacity (0.1). Offset: top: -19px, left: 16px, right: 16px */
.ctdv2-card-stack-2 {
    top: -19px;
    left: 16px;
    right: 16px;
    background-color: var(--accent-color, #ff4d6d) !important;
    border: 1px solid var(--accent-color, #ff4d6d) !important;
    opacity: 0.08 !important;
    z-index: -2;
}

/* Stack 3 (Rect 1 in SVG): Same size as front card, lightest color, opacity 0.6. Offset: top: -12px, left: 4px, right: -4px */
.ctdv2-card-stack-3 {
    top: -12px;
    left: 4px;
    right: -4px;
    background-color: var(--card-bg-stack-3, #fafafa) !important;
    border: 1px solid var(--card-border-stacked, rgba(255, 77, 109, 0.22)) !important;
    opacity: 0.6 !important;
    z-index: -3;
}

/* Lift front card on hover and expand background stacks */
.ctdv2-category-item:hover .ctdv2-card-front {
    transform: translateY(-5px);
    box-shadow: 
        0 12px 24px var(--card-border, rgba(255, 77, 109, 0.12)),
        0 4px 6px rgba(0, 0, 0, 0.02);
}

.ctdv2-category-item:hover .ctdv2-card-stack-1 {
    top: -12px;
    left: -4px;
}

.ctdv2-category-item:hover .ctdv2-card-stack-2 {
    top: -24px;
}

.ctdv2-category-item:hover .ctdv2-card-stack-3 {
    top: -17px;
    left: 6px;
}

/* Split vertical bar: top half solid accent, bottom half light accent (Longer 36px bar) */
.ctdv2-title-bar {
    display: inline-block;
    width: 5px !important;
    height: 40px !important;
    border-radius: 2.5px !important;
    background: linear-gradient(to bottom, var(--accent-color) 50%, var(--accent-light) 50%) !important;
    flex-shrink: 0;
    margin-top: 2px !important;
}

/* Badge styling - New (Top Left inside the card) */
.ctdv2-badge {
    position: absolute !important;
    top: 12px !important;
    left: 12px !important;
    padding: 4px 8px !important;
    border-radius: 5px !important;
    color: #ffffff !important;
    font-size: 9px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    z-index: 10 !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    transform: none !important;
    max-width: none !important;
    max-height: none !important;
    height: auto !important;
    width: auto !important;
    box-sizing: border-box !important;
}

/* Badge styling - PNG (Top Right inside the card) */
.ctdv2-png-badge {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    padding: 4px 8px !important;
    border-radius: 5px !important;
    color: #ffffff !important;
    font-size: 9px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    z-index: 10 !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    transform: none !important;
    max-width: none !important;
    max-height: none !important;
    height: auto !important;
    width: auto !important;
    box-sizing: border-box !important;
}

.ctdv2-category-title {
    margin: 0;
    font-weight: 700;
    color: #1f2937 !important;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    line-height: 1.2 !important;
}

.ctdv2-category-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
    max-height: 2.7em;
    width: 100%;
    margin: 0;
    color: #6b7280 !important;
    font-size: 11.5px !important;
    font-weight: 500;
}

/* Lazy loading */
.ctdv2-lazy {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.ctdv2-lazy.loaded {
    opacity: 1;
}

/* Grid Header Row */
.ctdv2-grid-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    flex-wrap: wrap;
    gap: 15px;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

.ctdv2-header-text {
    flex: 1;
    min-width: 250px;
}

.ctdv2-grid-title {
    margin: 0 0 5px 0 !important;
    font-weight: 700;
    line-height: 1.2;
}

.ctdv2-grid-subtitle {
    margin: 0 !important;
    line-height: 1.4;
}

.ctdv2-header-action {
    display: flex;
    align-items: center;
}

/* Action styles */
.ctdv2-action-btn {
    text-decoration: none !important;
    font-weight: 600;
    display: inline-block;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.ctdv2-action-link {
    background: none !important;
    border: none !important;
    padding: 0 !important;
}

.ctdv2-action-button {
    padding: 8px 18px !important;
    border-radius: 8px !important;
    text-align: center;
    border: none !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.ctdv2-action-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

/* Responsive Carousel Styles */
.ctdv2-carousel-wrapper {
    position: relative;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    padding: 20px 0; /* Space for the top badges */
}

/* Center Carousel display container, add side margins to buffer arrows */
.ctdv2-carousel-container {
    width: 100%;
    overflow: hidden;
    position: relative;
    cursor: grab;
    padding: 20px 30px; /* Side padding to host arrows without overlap */
    box-sizing: border-box;
}

.ctdv2-carousel-container:active {
    cursor: grabbing;
}

.ctdv2-carousel-track {
    display: flex;
    flex-wrap: nowrap !important;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    box-sizing: border-box;
}

.ctdv2-carousel-track .ctdv2-category-item {
    flex-shrink: 0;
    box-sizing: border-box;
    margin-bottom: 0 !important;
}

/* Side navigation arrows - Perfectly centered and inside container padding */
.ctdv2-carousel-arrow {
    position: absolute;
    top: calc(50% + 10px) !important; /* Offsets top stack cards to align perfectly to card body center */
    transform: translateY(-50%) !important;
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: #333333 !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08) !important;
    transition: all 0.3s ease !important;
    z-index: 10;
    padding: 0 !important;
    line-height: 1 !important;
}

.ctdv2-carousel-arrow:hover {
    background: var(--accent-color, #007cba) !important;
    color: #ffffff !important;
    border-color: var(--accent-color, #007cba) !important;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12) !important;
}

.ctdv2-carousel-prev {
    left: 10px; /* Sit inside the 30px container side padding */
}

.ctdv2-carousel-next {
    right: 10px; /* Sit inside the 30px container side padding */
}

/* Dot pagination indicators */
.ctdv2-carousel-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    box-sizing: border-box;
}

.ctdv2-carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cccccc;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ctdv2-carousel-dot.active {
    background: #007cba;
    width: 20px;
    border-radius: 4px;
}

/* Right Image layout & Micro-Animations */
.ctdv2-card-right {
    width: 80px !important;
    height: 80px !important;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: absolute !important;
    right: 12px !important;
    bottom: 12px !important;
    z-index: 2 !important;
    pointer-events: none;
}

.ctdv2-category-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    transform: scale(1.05);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    z-index: 3 !important;
    position: relative;
}

.ctdv2-card-front:hover .ctdv2-category-image {
    transform: scale(1.18) rotate(3deg); /* Premium 3D float/lift effect */
}

/* Abstract wave blob scaling - Crop-aligned to bottom right corner */
.ctdv2-card-blob {
    position: absolute !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 155px !important;
    height: 100px !important;
    pointer-events: none;
    z-index: 1 !important;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    transform-origin: bottom right;
}

.ctdv2-card-front:hover .ctdv2-card-blob {
    transform: scale(1.08); /* abstract paint blob expands on hover */
}
