/* ============================================
   RESPONSIVE VARIABLES & BREAKPOINTS
   Automatic responsive behavior - no user config needed
   ============================================ */

:root {
    /* Core responsive variables */
    --youposts-min-card-width: 280px;
    --youposts-base-gap: 16px;
    --youposts-touch-target: 44px;
    /* Minimum touch target for mobile */
}

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

.youposts-grid {
    display: grid;
    /* Use auto-fit with minmax for automatic column adjustment */
    grid-template-columns: repeat(auto-fit, minmax(min(var(--youposts-min-card-width), 100%), 1fr));
    gap: var(--gap, 2rem);
    margin: 2rem 0;
}

/* Desktop (1280px+): Respect user column preference */
@media (min-width: 1280px) {
    .youposts-grid {
        grid-template-columns: repeat(var(--columns, 4), 1fr);
        --youposts-min-card-width: 280px;
    }
}

/* Large screens (1024px - 1279px): Max 3-4 columns */
@media (min-width: 1024px) and (max-width: 1279px) {
    .youposts-grid {
        /* Clamp columns at max 4 */
        grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    }
}

/* Tablets (768px - 1023px): 2-3 columns */
@media (min-width: 768px) and (max-width: 1023px) {
    .youposts-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
        gap: clamp(12px, 2vw, 24px);
    }
}

/* Large phones (481px - 767px): 2 columns */
@media (min-width: 481px) and (max-width: 767px) {
    .youposts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: clamp(10px, 3vw, 16px);
    }
}

/* Small phones (320px - 480px): Single column */
@media (max-width: 480px) {
    .youposts-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin: 1rem 0;
    }
}

/* Ultra-small screens (< 320px): Ensure usability */
@media (max-width: 319px) {
    .youposts-grid {
        grid-template-columns: 1fr;
        gap: 8px;
        margin: 0.5rem 0;
    }
}

/* Video Card */
.youposts-video {
    background: var(--background, #ebebeb);
    border-radius: var(--border-radius, 8px);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.youposts-video.has-shadow,
.video-card.has-shadow,
.list-item.has-shadow {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.youposts-video.hover-lift:hover,
.video-card.hover-lift:hover,
.list-item.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

/* Reduced hover effects on touch devices */
@media (hover: none) and (pointer: coarse) {
    .youposts-video.hover-lift:hover,
    .video-card.hover-lift:hover,
    .list-item.hover-lift:hover {
        transform: none;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
}

/* Thumbnail */
.youposts-thumbnail {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: transparent;
}

.youposts-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.youposts-video.hover-zoom:hover .youposts-thumbnail img,
.video-card.hover-zoom:hover .video-card-thumbnail img,
.list-item.hover-zoom:hover .list-item-thumbnail img {
    transform: scale(1.05);
}

/* Reduce zoom on touch devices */
@media (hover: none) {
    .youposts-video.hover-zoom:hover .youposts-thumbnail img,
    .video-card.hover-zoom:hover .video-card-thumbnail img,
    .list-item.hover-zoom:hover .list-item-thumbnail img {
        transform: none;
    }
}

/* Ensure hover zoom stays contained */
.video-card-thumbnail,
.list-item-thumbnail {
    overflow: hidden;
}

.youposts-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
}

/* Content */
.youposts-content {
    background: var(--background, #ebebeb);
    padding: 12px 10px;
}

.youposts-title {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.youposts-title a {
    color: #333;
    text-decoration: none;
    /* Ensure touch-friendly tap target */
    display: block;
    min-height: var(--youposts-touch-target);
}

.youposts-title a:hover {
    color: #0073aa;
}

/* Large Card Variant (Featured) */
.youposts-video--large .youposts-content {
    padding: 16px 14px;
}

.youposts-video--large .youposts-title {
    font-size: 16px;
    font-weight: 500;
}

.youposts-excerpt {
    margin: 0.5rem 0 0 0;
    font-size: 0.9em;
    line-height: 1.6;
    color: #666;
}

.youposts-meta {
    margin: 0.5rem 0 0 0;
    font-size: 0.8em;
    color: #888;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ============================================
   CAROUSEL LAYOUT - RESPONSIVE
   ============================================ */

.youposts-carousel {
    margin: 2rem 0;
    position: relative;
    --slides-to-show: var(--slides, 3);
    --carousel-gap: var(--gap, 1rem);
}

/* Fix for Slick carousel gap */
.youposts-carousel .slick-list {
    margin: 0 calc(var(--carousel-gap) / -2);
}

.youposts-carousel .slick-slide>div {
    margin: 0 calc(var(--carousel-gap) / 2);
}

/* Carousel slide widths - use clamp for responsive sizing */
.youposts-carousel .slick-slide,
.youposts-carousel .carousel-item {
    /* Fluid width based on viewport */
    width: clamp(200px, 25vw, 320px);
}

/* Desktop (1280px+): Show more slides */
@media (min-width: 1280px) {
    .youposts-carousel {
        --slides-to-show: var(--slides, 4);
    }
}

/* Large screens (1024px - 1279px): 3-4 slides */
@media (min-width: 1024px) and (max-width: 1279px) {
    .youposts-carousel {
        --slides-to-show: 3;
    }

    .youposts-carousel .slick-slide,
    .youposts-carousel .carousel-item {
        width: clamp(220px, 28vw, 300px);
    }
}

/* Tablets (768px - 1023px): 2-3 slides */
@media (min-width: 768px) and (max-width: 1023px) {
    .youposts-carousel {
        --slides-to-show: 2;
        margin: 1.5rem 0;
    }

    .youposts-carousel .slick-slide,
    .youposts-carousel .carousel-item {
        width: clamp(200px, 35vw, 280px);
    }
}

/* Large phones (481px - 767px): 1.5-2 slides */
@media (min-width: 481px) and (max-width: 767px) {
    .youposts-carousel {
        --slides-to-show: 2;
        margin: 1rem 0;
    }

    .youposts-carousel .slick-slide,
    .youposts-carousel .carousel-item {
        width: clamp(160px, 45vw, 260px);
    }
}

/* Small phones (320px - 480px): 1 slide centered or peek next */
@media (max-width: 480px) {
    .youposts-carousel {
        --slides-to-show: 1;
        margin: 1rem 0;
    }

    .youposts-carousel .slick-slide,
    .youposts-carousel .carousel-item {
        width: clamp(140px, 80vw, 280px);
    }
}

/* Slick Carousel Customization */
.slick-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: var(--show-arrows, block);
    /* Ensure touch-friendly size */
    min-width: var(--youposts-touch-target);
    min-height: var(--youposts-touch-target);
}

.slick-arrow:hover {
    background: rgba(0, 0, 0, 0.8);
}

.slick-prev {
    left: -20px;
}

.slick-next {
    right: -20px;
}

/* Tablet/Mobile arrows - larger and better positioned */
@media (max-width: 1024px) {
    .slick-arrow {
        width: 36px;
        height: 36px;
    }

    .slick-prev {
        left: 8px;
    }

    .slick-next {
        right: 8px;
    }
}

@media (max-width: 768px) {
    .slick-arrow {
        width: 44px;
        height: 44px;
        background: rgba(0, 0, 0, 0.7);
    }

    .slick-prev {
        left: 4px;
    }

    .slick-next {
        right: 4px;
    }
}

.slick-dots {
    position: absolute;
    bottom: -30px;
    left: 0;
    right: 0;
    display: var(--show-dots, flex);
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.slick-dots li {
    margin: 0;
}

.slick-dots button {
    width: 10px;
    height: 10px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #ddd;
    text-indent: -9999px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    /* Touch-friendly hit area */
    min-width: var(--youposts-touch-target);
    min-height: var(--youposts-touch-target);
    display: flex;
    align-items: center;
    justify-content: center;
}

.slick-dots button::before {
    content: '';
    display: block;
    width: 10px;
    height: 10px;
    background: #ddd;
    border-radius: 50%;
}

.slick-dots .slick-active button::before {
    background: #0073aa;
}

/* Mobile: Larger dots for touch */
@media (max-width: 768px) {
    .slick-dots button::before {
        width: 12px;
        height: 12px;
    }

    .slick-dots {
        gap: 12px;
        bottom: -36px;
    }
}

/* Modal */
.youposts-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.youposts-modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    aspect-ratio: 16/9;
}

.youposts-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    /* Touch-friendly close button */
    min-width: var(--youposts-touch-target);
    min-height: var(--youposts-touch-target);
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .youposts-modal-content {
        width: 95%;
    }

    .youposts-modal-close {
        top: -50px;
        font-size: 28px;
    }
}

.youposts-modal-video {
    width: 100%;
    height: 100%;
}

.youposts-modal-video iframe {
    width: 100%;
    height: 100%;
}

/* Loading States */
.youposts-loading {
    position: relative;
    min-height: 200px;
}

.youposts-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: youposts-spin 1s linear infinite;
}

@keyframes youposts-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Error States */
.youposts-error {
    padding: 2rem;
    text-align: center;
    color: #dc3232;
    background: #fdf2f2;
    border-radius: 4px;
}

/* Empty States */
.youposts-empty {
    padding: 2rem;
    text-align: center;
    color: #666;
    background: #f8f9fa;
    border-radius: 4px;
}

/* ============================================
   VIDEO CARD STYLES
   ============================================ */

/* Basic Card (Default) - uses CSS variables from parent grid */
.youposts-video.card-basic {
    background: var(--background, #ebebeb);
    border-radius: var(--border-radius, 8px);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Modern Overlay */
.youposts-video.card-modern {
    position: relative;
    background: transparent;
}

.youposts-video.card-modern .youposts-thumbnail {
    margin: 0;
}

.youposts-video.card-modern .youposts-title,
.youposts-video.card-modern .youposts-meta {
    position: absolute;
    left: 0;
    right: 0;
    color: #fff;
    margin: 0;
    padding: 1rem;
    z-index: 2;
}

.youposts-video.card-modern .youposts-title {
    bottom: 2.5rem;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
    padding-bottom: 2rem;
}

.youposts-video.card-modern .youposts-meta {
    bottom: 0;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
}

.youposts-video.card-modern .youposts-title a {
    color: #fff;
}

/* Minimal Clean */
.youposts-video.card-minimal {
    background: transparent;
    border-radius: 0;
}

.youposts-video.card-minimal .youposts-thumbnail {
    border-radius: var(--border-radius, 8px);
    margin-bottom: 1rem;
}

.youposts-video.card-minimal .youposts-title {
    font-weight: 500;
    margin: 0.5rem 0;
}

.youposts-video.card-minimal .youposts-meta {
    margin: 0.5rem 0;
    opacity: 0.7;
}

/* Gradient Hover */
.youposts-video.card-gradient {
    position: relative;
    overflow: hidden;
}

.youposts-video.card-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, var(--primary-color, #0073aa) 0%, var(--secondary-color, #00a0d2) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    border-radius: var(--border-radius, 8px);
}

.youposts-video.card-gradient:hover::before {
    opacity: 0.9;
}

.youposts-video.card-gradient .youposts-title,
.youposts-video.card-gradient .youposts-meta,
.youposts-video.card-gradient .youposts-excerpt {
    position: absolute;
    left: 0;
    right: 0;
    color: #fff;
    padding: 1rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 2;
}

.youposts-video.card-gradient:hover .youposts-title,
.youposts-video.card-gradient:hover .youposts-meta,
.youposts-video.card-gradient:hover .youposts-excerpt {
    opacity: 1;
    transform: translateY(0);
}

.youposts-video.card-gradient .youposts-title {
    top: 1rem;
}

.youposts-video.card-gradient .youposts-excerpt {
    top: 50%;
    transform: translateY(-50%);
    padding: 2rem 1rem;
    color: rgba(255, 255, 255, 0.9);
    max-height: 30%;
    overflow-y: auto;
}

.youposts-video.card-gradient:hover .youposts-excerpt {
    transform: translateY(-50%);
}

.youposts-video.card-gradient .youposts-meta {
    bottom: 1rem;
    background: rgba(0, 0, 0, 0.2);
    margin: 0;
    padding: 0.5rem 1rem;
}

.youposts-video.card-gradient .youposts-title a {
    color: #fff;
}

/* Cinematic Wide */
.youposts-video.card-cinematic {
    display: flex;
    flex-direction: row;
    background: var(--background, #ffffff);
    min-height: 200px;
}

.youposts-video.card-cinematic .youposts-thumbnail {
    flex: 0 0 50%;
    margin: 0;
}

.youposts-video.card-cinematic .youposts-content {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.youposts-video.card-cinematic .youposts-title {
    font-size: 1.3em;
    margin: 0 0 1rem 0;
}

.youposts-video.card-cinematic .youposts-excerpt {
    margin: 0 0 1rem 0;
}

.youposts-video.card-cinematic .youposts-meta {
    margin: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding-top: 1rem;
}

/* Cinematic: Stack on mobile */
@media (max-width: 768px) {
    .youposts-video.card-cinematic {
        flex-direction: column;
        min-height: auto;
    }

    .youposts-video.card-cinematic .youposts-thumbnail {
        flex: 0 0 auto;
    }

    .youposts-video.card-cinematic .youposts-content {
        padding: 1rem;
    }

    .youposts-video.card-cinematic .youposts-title {
        font-size: 1.1em;
    }
}

/* Infinite Scroll Loader */
.youposts-loader {
    text-align: center;
    padding: 2rem;
    font-size: 0.9em;
    color: #666;
    position: relative;
    clear: both;
    width: 100%;
}

.youposts-loader::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border: 2px solid #ddd;
    border-top-color: #0073aa;
    border-radius: 50%;
    vertical-align: middle;
    animation: youposts-spin 1s linear infinite;
}

/* Layout Editor Form */
.youposts-form-section {
    margin-bottom: 2rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.youposts-form-section h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.youposts-form-row {
    margin-bottom: 1rem;
}

.youposts-form-row label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.radio-group {
    display: flex;
    gap: 1rem;
}

.radio-group label {
    display: flex;
    align-items: center;
    margin: 0;
    font-weight: normal;
}

.radio-group input[type="radio"] {
    margin-right: 0.5rem;
}

.loading-text-option {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

/* Form Controls */
.youposts-form-row input[type="text"],
.youposts-form-row input[type="number"],
.youposts-form-row select {
    width: 100%;
    max-width: 300px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    margin: 0;
    font-weight: normal;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

.style-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.option-group {
    display: flex;
    flex-direction: column;
}

.option-group label {
    margin-bottom: 0.5rem;
}

/* Layout Type Settings */
.layout-type-settings {
    display: none;
}

.layout-type-settings.active {
    display: block;
}

/* ============================================
   ADMIN INTERFACE STYLES (Refactored)
   ============================================ */
/* 
    This section keeps standard variable names or hardcoded colors
    to ensure consistency regardless of external admin theme inconsistencies.
*/

:root {
    --youposts-admin-white: #ffffff;
    --youposts-admin-bg: #f8fafc;
    --youposts-admin-border: #e2e8f0;
    --youposts-admin-text: #1e293b;
    --youposts-admin-text-light: #64748b;
    --youposts-admin-primary: #2271b1;
    --youposts-admin-primary-hover: #135e96;
    --youposts-admin-success: #10b981;
    --youposts-admin-card-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --youposts-admin-card-hover-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* Layout Listing Grid */
.youposts-layouts-container {
    padding: 20px 0;
}

.youposts-saved-layouts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

/* Refined Layout Card */
.youposts-layout-card {
    background: var(--youposts-admin-white);
    border: 1px solid var(--youposts-admin-border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.youposts-layout-card:hover {
    box-shadow: var(--youposts-admin-card-hover-shadow);
    transform: translateY(-2px);
    border-color: var(--youposts-admin-primary);
}

/* Preview Area */
.youposts-layout-preview {
    background: var(--youposts-admin-bg);
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--youposts-admin-border);
    position: relative;
    padding: 20px;
}

/* Template Badge */
.youposts-template-badge {
    position: absolute;
    /* positioned inside preview or title */
    display: inline-block;
    background: linear-gradient(135deg, #2271b1 0%, #00a0d2 100%);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(34, 113, 177, 0.2);
    margin-left: 8px;
    vertical-align: middle;
}

/* Layout Info Container */
.youposts-layout-info {
    padding: 20px;
    flex-grow: 1;
}

.youposts-layout-name {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--youposts-admin-text);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

/* Refined Shortcode Display */
.youposts-shortcode {
    display: block;
    background: var(--youposts-admin-bg);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    color: var(--youposts-admin-primary);
    border: 1px dashed var(--youposts-admin-border);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.youposts-shortcode:hover {
    background: #fff;
    border-color: var(--youposts-admin-primary);
    box-shadow: 0 0 0 1px var(--youposts-admin-primary);
}

/* Actions Footer */
.youposts-layout-actions {
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid var(--youposts-admin-border);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.youposts-layout-actions .button {
    font-size: 13px;
}

/* Empty State */
.youposts-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--youposts-admin-white);
    border: 2px dashed var(--youposts-admin-border);
    border-radius: 12px;
    margin-bottom: 24px;
}

.youposts-empty-state p {
    font-size: 16px;
    color: var(--youposts-admin-text-light);
    margin-bottom: 20px;
}

/* Layout Editor Modal - The main fix for "white on white" or "dark on dark" issues */
/* Layout Editor Modal - content container */
.youposts-modal-content {
    background: var(--youposts-admin-bg);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    width: 90%;
    max-width: 1400px;
    height: 90vh;
    /* Force height so scrolling works internally */
    display: flex;
    flex-direction: column;
}

.youposts-modal-close {
    background: transparent;
    color: #fff;
    width: 44px;
    height: 44px;
    top: 0;
    right: -50px;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    cursor: pointer;
}

/* Layout Editor Wrapper - The Grid */
.youposts-layout-editor-wrapper {
    display: grid;
    grid-template-columns: 1fr 450px;
    /* Form | Preview */
    height: 100%;
    overflow: hidden;
}

/* Left Column: Form */
.youposts-editor-form {
    padding: 0;
    background: var(--youposts-admin-white);
    border: none;
    height: 100%;
    overflow-y: auto;
    /* Internal scrolling */
    position: relative;
    display: flex;
    flex-direction: column;
}

#youposts-layout-form {
    padding: 30px;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
    flex-grow: 1;
}

/* Right Column: Preview */
.youposts-editor-preview {
    background: #f0f0f1;
    border-left: 1px solid var(--youposts-admin-border);
    height: 100%;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.youposts-editor-preview h4 {
    margin-top: 0;
    font-size: 13px;
    text-transform: uppercase;
    color: #646970;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dcdcde;
}

.youposts-name-field input:focus {
    border-color: var(--youposts-admin-primary);
    box-shadow: 0 0 0 1px var(--youposts-admin-primary);
    outline: none;
}

/* Mobile Responsive */
@media (max-width: 1280px) {
    .youposts-layout-editor-wrapper {
        grid-template-columns: 1fr 350px;
    }
}

@media (max-width: 1024px) {
    .youposts-layout-editor-wrapper {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 300px;
    }

    .youposts-editor-preview {
        border-left: none;
        border-top: 1px solid var(--youposts-admin-border);
    }
}

.youposts-basic-settings,
.youposts-advanced-options {
    background: var(--youposts-admin-white);
    padding: 24px;
    border-radius: 8px;
    border: 1px solid var(--youposts-admin-border);
    margin-bottom: 24px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.youposts-basic-settings h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: var(--youposts-admin-text);
    border-bottom: 1px solid var(--youposts-admin-border);
    padding-bottom: 12px;
}

/* Layout Type Picker (Refined) */
.youposts-layout-type-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
    max-width: 800px;
}

.youposts-layout-type-card {
    background: var(--youposts-admin-white);
    border: 2px solid var(--youposts-admin-border);
    border-radius: 10px;
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    /* Ensure no text color inheritance issues */
    color: var(--youposts-admin-text);
}

.youposts-layout-type-card:hover {
    border-color: var(--youposts-admin-gray-300);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.youposts-layout-type-card.selected {
    border-color: var(--youposts-admin-primary);
    background: #f0f6fc;
    /* Very light blue */
}

.youposts-type-icon {
    color: var(--youposts-admin-text-light);
    margin-bottom: 16px;
}

.youposts-layout-type-card.selected .youposts-type-icon {
    color: var(--youposts-admin-primary);
}

.youposts-type-name {
    color: var(--youposts-admin-text);
    font-weight: 700;
}

.youposts-layout-type-card.selected .youposts-type-name {
    color: var(--youposts-admin-primary);
}

.youposts-type-desc {
    color: var(--youposts-admin-text-light);
}

/* Checkmark Badge */
.youposts-type-checkmark {
    background: var(--youposts-admin-primary);
}

/* Style Picker (Visual Style) */
.youposts-style-card {
    border: 2px solid var(--youposts-admin-border);
    background: var(--youposts-admin-white);
    padding: 12px;
    border-radius: 8px;
}

.youposts-style-card:hover {
    border-color: var(--youposts-admin-gray-300);
}

.youposts-style-card[aria-checked="true"] {
    border-color: var(--youposts-admin-primary);
    background: #f0f6fc;
}

.youposts-style-label {
    color: var(--youposts-admin-text);
    margin-top: 10px;
}

.youposts-style-card[aria-checked="true"] .youposts-style-label {
    color: var(--youposts-admin-primary);
}

.youposts-checkmark {
    background: var(--youposts-admin-primary);
}

/* Accordion Content */
.youposts-accordion-content {
    padding: 20px;
    background: var(--youposts-admin-white);
    border-top: 1px solid var(--youposts-admin-border);
}

/* Modal Buttons Panel */
.youposts-form-actions {
    background: var(--youposts-admin-white);
    padding: 20px 24px;
    border-top: 1px solid var(--youposts-admin-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

/* Help Tip */
.youposts-help-tip {
    background: var(--youposts-admin-gray-300);
    color: var(--youposts-admin-text);
    font-weight: bold;
    font-size: 11px;
}

/* Skeleton Loading Support */
.youposts-preview-loading .youposts-preview-card,
.youposts-preview-loading .youposts-preview-slide {
    background: linear-gradient(90deg,
            var(--youposts-admin-gray-100) 25%,
            var(--youposts-admin-gray-200) 50%,
            var(--youposts-admin-gray-100) 75%);
    background-size: 200% 100%;
    animation: youposts-skeleton 1.5s ease-in-out infinite;
}

@keyframes youposts-skeleton {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Dark Mode Overrides (Admin) */
/* This targets the admin interface explicitly to invert our new variables */
/* Dark Mode removed to ensure consistency with WP Admin default theme */
