/* DreamFrame AI Replica Styles */

:root {
    --df-bg-sidebar: #f8f9fa;
    --df-bg-main: #f0f2f5;
    --df-surface: #ffffff;
    --df-text-main: #1d1d1f;
    --df-text-muted: #86868b;
    --df-text-light: #aaa;
    --df-border: #e6e8eb;
    --df-accent: #000000;
    --df-green: #20c997;
    --df-green-light: #e6f9f3;
    --df-shadow-soft: 0 8px 30px rgba(0,0,0,0.08);
    --df-shadow-hard: 0 10px 40px rgba(0,0,0,0.12);
    --df-radius-lg: 16px;
    --df-radius-md: 12px;
    --df-radius-sm: 8px;
    --df-font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
}

body.df-body {
    margin: 0;
    padding: 0;
    background: var(--df-bg-main);
    font-family: var(--df-font);
    overflow: hidden; /* App handles its own scrolling */
}

/* App Layout */
.df-app {
    display: flex;
    height: 100vh;
    width: 100vw;
    padding: 16px 24px 16px;
    box-sizing: border-box;
    gap: 24px;
}

/* --- SIDEBAR --- */
.df-sidebar {
    width: 260px;
    background: var(--df-surface);
    border: none;
    border-radius: var(--df-radius-lg);
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    z-index: 10;
}

.df-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 24px;
    margin-bottom: 32px;
    font-size: 18px;
    color: var(--df-text-main);
}
.df-logo strong { font-weight: 700; }
.df-logo span { font-weight: 400; }

.df-nav {
    flex: 1;
    padding: 0 12px;
}

.df-nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: var(--df-radius-sm);
    color: var(--df-text-main);
    font-weight: 500;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 4px;
    transition: background 0.2s;
    text-decoration: none;
}

.df-nav-item:hover, .df-nav-item.active {
    background: var(--df-bg-sidebar);
}

.df-nav-item .df-icon {
    width: 20px;
    margin-right: 12px;
    font-size: 16px;
    color: var(--df-text-muted);
}

.df-nav-item .df-chevron {
    margin-left: auto;
    font-size: 10px;
    color: var(--df-text-light);
}

.df-sub-nav {
    padding-left: 48px;
    padding-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}

.df-sub-nav::before {
    content: '';
    position: absolute;
    left: 23px;
    top: -10px;
    bottom: 20px;
    width: 1px;
    background: var(--df-border);
}

.df-sub-nav a {
    text-decoration: none;
    color: var(--df-text-muted);
    font-size: 13px;
    font-weight: 500;
}

.df-sub-nav a.active {
    color: var(--df-text-main);
}
.df-sub-nav a.df-nav-disabled {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.df-my-scenes {
    padding: 24px;
    border-top: 1px solid var(--df-border);
}

.df-scenes-title {
    font-size: 12px;
    color: var(--df-text-light);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.df-create-scene {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--df-text-main);
    font-size: 14px;
    font-weight: 600;
}
.df-create-scene .df-icon-plus {
    font-size: 18px;
    color: var(--df-text-muted);
}

/* --- MAIN CONTENT --- */
.df-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: transparent;
    gap: 0;
    overflow: hidden;
    padding-top: 0;
}

/* Top fade+blur overlay - just below header bottom edge */
.df-main::before {
    content: '';
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(to bottom, var(--df-bg-main), transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    mask-image: linear-gradient(to bottom, black, transparent);
    -webkit-mask-image: linear-gradient(to bottom, black, transparent);
    z-index: 15;
    pointer-events: none;
}

/* Bottom fade+blur overlay - above prompt bar */
.df-main::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(to top, var(--df-bg-main), transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    mask-image: linear-gradient(to top, black, transparent);
    -webkit-mask-image: linear-gradient(to top, black, transparent);
    z-index: 10;
    pointer-events: none;
}

/* TOPBAR */
.df-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--df-surface);
    border-radius: var(--df-radius-lg);
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    margin: 0 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 20;
}

.df-top-left, .df-top-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.df-icon-btn {
    background: transparent;
    border: none;
    color: var(--df-text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
}
.df-icon-btn:hover { background: rgba(0,0,0,0.05); }

.df-search {
    background: var(--df-bg-sidebar);
    border: 1px solid var(--df-border);
    border-radius: 30px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    width: 320px;
    gap: 10px;
}
.df-search input {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    font-size: 14px;
}
.df-search-icon { color: var(--df-text-muted); font-size: 14px; }

.df-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--df-text-main);
}
.df-dot {
    width: 6px;
    height: 6px;
    background: var(--df-green);
    border-radius: 50%;
}

.df-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--df-text-main);
    text-decoration: none;
}

.df-btn-outline {
    background: transparent;
    border: 1px solid var(--df-border);
    color: var(--df-text-main);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
    text-decoration: none;
}
.df-btn-outline:hover { background: rgba(0,0,0,0.02); }

.df-avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: block;
}

/* CONTENT AREA */
.df-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 8px 180px;
}

.df-categories-wrapper {
    position: relative;
    margin-bottom: 24px;
    overflow: hidden;
}

.df-categories-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
    padding: 2px 0;
}
.df-categories-row::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

/* Category Navigation Arrows */
.df-cat-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: var(--df-surface);
    border: 1px solid var(--df-border);
    border-radius: 50%;
    display: none; /* Controlled by JS */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    z-index: 10;
    color: var(--df-text-muted);
    transition: all 0.2s;
}
.df-cat-nav:hover {
    background: var(--df-bg-hover);
    color: var(--df-text-main);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.df-cat-nav:disabled {
    opacity: 0.3;
    cursor: default;
}
.df-cat-prev { left: 0; }
.df-cat-next { right: 0; }

.df-cat-card {
    flex-shrink: 0;
    background: var(--df-surface);
    border: 1px solid var(--df-border);
    border-radius: 14px;
    padding: 8px 14px 8px 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.df-cat-card:hover {
    background: var(--df-bg-hover);
    border-color: rgba(0,0,0,0.1);
}
.df-cat-card.df-cat-active {
    background: rgba(0,0,0,0.05); /* Soft, non-intense background instead of black */
    border-color: rgba(0,0,0,0.15);
}
.df-cat-card.df-cat-active .df-cat-text strong {
    color: var(--df-text-main);
}
.df-cat-card.df-cat-active .df-cat-text span {
    color: var(--df-text-muted);
}

.df-cat-img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
}

.df-cat-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.df-cat-text strong {
    font-size: 13px;
    font-weight: 600;
    color: var(--df-text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.df-cat-text span {
    font-size: 11px;
    color: var(--df-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* MASONRY GRID */
.df-masonry {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 24px;
    grid-auto-rows: 43px;
    grid-auto-flow: dense;
}

.df-masonry-item {
    background: var(--df-surface);
    border-radius: var(--df-radius-lg);
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    cursor: pointer;
}
/* Finer row size (43px) allows middle cards to be slightly taller.
   Left/Right: span 7 ≈ 445px.  Middle: span 5 ≈ 311px. */
.df-masonry-item:nth-child(3n+1) { grid-column: 1; grid-row: span 7; } /* Left Column: Tall */
.df-masonry-item:nth-child(3n+2) { grid-column: 2; grid-row: span 5; } /* Middle Column */
.df-masonry-item:nth-child(3n)   { grid-column: 3; grid-row: span 7; } /* Right Column: Tall */

/* Center last item when alone on its row */
.df-masonry-item:last-child:nth-child(3n+1),
.df-masonry-item:nth-last-child(2):nth-child(3n+1) {
    grid-column: 2;
    grid-row: span 5;
}
.df-masonry-item:last-child:nth-child(3n+1) .df-masonry-img,
.df-masonry-item:nth-last-child(2):nth-child(3n+1) .df-masonry-img {
    transform: none;
}

/* Tag pills on cards */
.df-card-tags {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    z-index: 3;
}
.df-card-tag {
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: white;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

/* Category filtering */
.df-masonry-item.df-hidden {
    display: none;
}
/* active state handled above in .df-cat-card.df-cat-active */

.df-masonry-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 15%;
    display: block;
    transition: transform 0.3s ease;
}

/* Make images larger in tall columns (left & right) */
.df-masonry-item:nth-child(3n+1) .df-masonry-img,
.df-masonry-item:nth-child(3n) .df-masonry-img {
    transform: scale(1.15);
    transform-origin: center 15%;
}

.df-masonry-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 16px;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    opacity: 0;
    transition: opacity 0.2s;
}
.df-masonry-item:hover .df-masonry-overlay { opacity: 1; }

.df-user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 13px;
    font-weight: 500;
}
.df-user-badge img {
    width: 24px; height: 24px; border-radius: 50%;
}

.df-action-icons {
    display: flex;
    gap: 8px;
}
.df-action-icons button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
    cursor: pointer;
}
.df-action-icons button:hover { background: rgba(255,255,255,0.4); }

/* LIKE BUTTON */
.df-like-btn {
    position: relative;
    transition: transform 0.2s ease;
}
.df-like-btn.df-liked {
    animation: df-like-pop 0.3s ease;
}
@keyframes df-like-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* Like Count Bubble */
.df-like-bubble {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.9);
    font-size: 10px;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
    pointer-events: none;
    z-index: 2;
}

/* STUDIO TABS - removed, using sidebar sub-nav now */

/* PROFILE POPOVER */
.df-profile-popover {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 260px;
    background: var(--df-surface);
    border-radius: 16px;
    border: 1px solid var(--df-border);
    box-shadow: 0 12px 40px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04);
    padding: 16px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.96);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    pointer-events: none;
}
.df-profile-popover.df-popover-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* CART POPOVER */
.df-cart-popover.df-popover-open {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    pointer-events: auto;
}

.df-popover-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
}
.df-popover-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}
.df-popover-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--df-text-main);
}
.df-popover-email {
    font-size: 12px;
    color: var(--df-text-muted);
    margin-top: 2px;
}
.df-popover-divider {
    height: 1px;
    background: var(--df-border);
    margin: 8px 0;
}
.df-popover-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    border-radius: 8px;
    color: var(--df-text-main);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s;
}
.df-popover-link:hover {
    background: rgba(0,0,0,0.04);
}
.df-popover-link svg {
    color: var(--df-text-muted);
    flex-shrink: 0;
}
.df-popover-logout {
    color: var(--df-text-muted);
}

/* FLOATING PROMPT */
.df-prompt-container {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 700px;
    z-index: 100;
}

.df-prompt-inner {
    background: var(--df-surface);
    border-radius: 24px;
    padding: 16px 20px;
    box-shadow: var(--df-shadow-hard);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.df-prompt-input-wrapper {
    width: 100%;
}
.df-prompt-input-wrapper input {
    width: 100%;
    border: none;
    font-size: 16px;
    color: var(--df-text-main);
    outline: none;
    background: transparent;
}
.df-prompt-input-wrapper input::placeholder {
    color: var(--df-text-muted);
}

.df-prompt-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.df-actions-left, .df-actions-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.df-action-btn {
    border: 1px solid var(--df-border);
    background: transparent;
    color: var(--df-text-main);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.df-round-btn {
    width: 32px; height: 32px;
    border-radius: 50%;
}

.df-pill-btn {
    padding: 8px 16px;
    border-radius: 30px;
}

.df-pill-green {
    background: var(--df-green-light);
    color: var(--df-green);
    border-color: transparent;
}
.df-pill-green:hover { background: #d3f4ea; }

.df-icon-only {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    font-size: 18px;
}

.df-submit-btn {
    background: var(--df-accent);
    color: white;
    border: none;
    width: 32px; height: 32px;
    border-radius: 50%;
    font-weight: bold;
}
.df-submit-btn:hover {
    background: #333;
}

.df-submit-btn:disabled {
    opacity: 0.5; cursor: not-allowed;
}

/* UPLOAD POPOVER */
.df-upload-popover {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    width: 220px;
    background: var(--df-surface);
    border-radius: 14px;
    border: 1px solid var(--df-border);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    padding: 6px;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}
.df-upload-popover.df-popover-open {
    opacity: 1; visibility: visible; transform: translateY(0);
}
.df-upload-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--df-text-main);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    font-family: var(--df-font);
    transition: background 0.15s;
}
.df-upload-option:hover { background: rgba(0,0,0,0.04); }
.df-upload-option svg { flex-shrink: 0; color: var(--df-text-main); }
.df-upload-disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.df-upload-disabled:hover { background: transparent; }
.df-soon-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    color: var(--df-text-muted);
    background: var(--df-border);
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

/* REFERENCE IMAGE PREVIEW */
.df-ref-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
}
.df-ref-preview img {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--df-border);
}
.df-ref-remove {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.08);
    color: var(--df-text-muted);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.df-ref-remove:hover { background: rgba(0,0,0,0.15); }

/* AI MODEL POPOVER */
.df-model-popover {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    width: 280px;
    background: var(--df-surface);
    border-radius: 14px;
    border: 1px solid var(--df-border);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    padding: 6px;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}
.df-model-popover.df-popover-open {
    opacity: 1; visibility: visible; transform: translateY(0);
}
.df-model-option {
    display: block;
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-radius: 10px;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-family: var(--df-font);
    transition: background 0.15s;
}
.df-model-option:hover { background: rgba(0,0,0,0.04); }
.df-model-option.active { background: rgba(0,0,0,0.05); }
.df-model-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--df-text-main);
}
.df-model-desc {
    font-size: 12px;
    color: var(--df-text-muted);
    margin-top: 2px;
}

/* EXPANDABLE CHAT PANEL */
.df-chat-panel {
    max-height: 350px;
    display: flex;
    flex-direction: column;
}
.df-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
}
.df-chat-new-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--df-border);
    border-radius: 8px;
    background: transparent;
    color: var(--df-text-main);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--df-font);
    transition: background 0.15s;
}
.df-chat-new-btn:hover { background: rgba(0,0,0,0.04); }
.df-chat-collapse-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--df-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.df-chat-collapse-btn:hover { background: rgba(0,0,0,0.04); }
.df-chat-divider {
    height: 1px;
    background: var(--df-border);
    margin-bottom: 12px;
}
.df-chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 0 12px;
    max-height: 260px;
}
.df-chat-messages::-webkit-scrollbar { width: 4px; }
.df-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.12);
    border-radius: 2px;
}

/* Chat Message Bubbles */
.df-msg {
    display: flex;
    gap: 8px;
    max-width: 85%;
}
.df-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.df-msg-ai {
    align-self: flex-start;
}
.df-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    margin-top: 2px;
}
.df-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}
.df-msg-user .df-msg-bubble {
    background: var(--df-accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.df-msg-ai .df-msg-bubble {
    background: rgba(0,0,0,0.05);
    color: var(--df-text-main);
    border-bottom-left-radius: 4px;
}

/* Chat expanded state */
.df-prompt-container.df-chat-expanded .df-prompt-inner {
    border-radius: 20px;
}

/* LOADER modal */
.df-modal-loader {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
}

.df-spinner {
    width: 50px; height: 50px;
    border: 4px solid var(--df-border);
    border-top-color: var(--df-accent);
    border-radius: 50%;
    animation: df-spin 1s linear infinite;
}
@keyframes df-spin { to { transform: rotate(360deg); } }

/* ============================
   DESIGN DETAIL PAGE
   ============================ */

/* Make masonry cards clickable */
.df-masonry-item { cursor: pointer; }

/* Back button */
.df-detail-back {
    padding: 20px 40px 0;
}
.df-detail-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--df-text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 10px;
    transition: all 0.2s;
}
.df-detail-back-btn:hover {
    background: var(--df-surface);
    color: var(--df-text-main);
}

/* Main layout: 2-column */
.df-detail-layout {
    display: flex;
    gap: 40px;
    padding: 24px 40px 40px;
    align-items: flex-start;
}

/* Hero image area */
.df-detail-hero {
    flex: 3;
    min-width: 0;
    border-radius: 20px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}
.df-detail-hero-img {
    max-width: 100%;
    max-height: 560px;
    object-fit: contain;
    border-radius: 12px;
    filter: drop-shadow(0 12px 40px rgba(0,0,0,0.15));
    transition: opacity 0.3s ease;
}

/* Thumbnail strip */
.df-detail-thumbs {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}
.df-detail-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s;
}
.df-detail-thumb:hover { opacity: 0.9; }
.df-detail-thumb.active {
    border-color: var(--df-accent);
    opacity: 1;
}

/* Sidebar */
.df-detail-sidebar {
    flex: 2;
    min-width: 280px;
    max-width: 380px;
}

/* Creator badge */
.df-detail-creator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--df-border);
}
.df-detail-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
}
.df-detail-creator-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.df-detail-creator-info strong {
    font-size: 15px;
    color: var(--df-text-main);
}
.df-detail-cat {
    font-size: 12px;
    color: var(--df-text-muted);
    margin-top: 2px;
}
.df-detail-follow-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid var(--df-border);
    background: var(--df-surface);
    color: var(--df-text-main);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.df-detail-follow-btn:hover {
    background: var(--df-accent);
    color: #fff;
    border-color: var(--df-accent);
}

/* Title + description */
.df-detail-title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 12px;
    color: var(--df-text-main);
}
.df-detail-desc {
    font-size: 14px;
    line-height: 1.6;
    color: var(--df-text-muted);
    margin: 0 0 28px;
}

/* Action buttons */
.df-detail-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}
.df-detail-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 24px;
    border-radius: 12px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s;
}
.df-detail-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.df-detail-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 24px;
    border-radius: 12px;
    background: transparent;
    color: var(--df-text-main);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--df-border);
    cursor: pointer;
    transition: all 0.2s;
}
.df-detail-btn-secondary:hover {
    background: var(--df-surface);
    border-color: var(--df-text-muted);
}

/* Like + meta row */
.df-detail-meta-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--df-border);
}
.df-detail-like-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid var(--df-border);
    background: var(--df-surface);
    cursor: pointer;
    color: var(--df-text-main);
    transition: all 0.2s;
}
.df-detail-like-btn:hover {
    border-color: #e74c3c;
    color: #e74c3c;
}
.df-detail-date {
    font-size: 13px;
    color: var(--df-text-muted);
}

/* Tags */
.df-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.df-detail-tag {
    padding: 6px 14px;
    border-radius: 8px;
    background: var(--df-surface);
    border: 1px solid var(--df-border);
    font-size: 12px;
    font-weight: 500;
    color: var(--df-text-muted);
}

/* More from creator */
.df-detail-more {
    padding: 0 0 60px;
}
.df-detail-more h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 20px;
    color: var(--df-text-main);
}
.df-detail-more-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.df-detail-more-card {
    border-radius: 14px;
    overflow: hidden;
    padding: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
}
.df-detail-more-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}
.df-detail-more-card img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    display: block;
}

/* Responsive */
@media (max-width: 900px) {
    .df-detail-layout {
        flex-direction: column;
        padding: 20px;
    }
    .df-detail-sidebar {
        max-width: 100%;
    }
    .df-detail-hero {
        padding: 24px;
    }
    .df-detail-back {
        padding: 16px 20px 0;
    }
    .df-detail-more {
        padding: 0 0 40px;
    }
}

/* ============================
   BROWSE BY CATEGORY GRID
   ============================ */
.df-browse-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.df-browse-card {
    border-radius: 14px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.25s, box-shadow 0.25s;
}
.df-browse-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

/* Collage layout */
.df-browse-collage {
    display: flex;
    gap: 2px;
    aspect-ratio: 4/3;
    overflow: hidden;
}
.df-browse-collage-main {
    flex: 3;
    overflow: hidden;
}
.df-browse-collage-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.df-browse-collage-main.df-browse-collage-full {
    flex: 1;
}
.df-browse-collage-side {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}
.df-browse-collage-side img {
    width: 100%;
    flex: 1;
    object-fit: cover;
    display: block;
    min-height: 0;
}

/* Label overlay */
.df-browse-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 16px 14px;
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 100%);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.df-browse-label strong {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.df-browse-label span {
    color: rgba(255,255,255,0.8);
    font-size: 12px;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 1100px) {
    .df-browse-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 800px) {
    .df-browse-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
    .df-browse-grid { grid-template-columns: 1fr; }
}

/* LEADERBOARD LIST */
.df-leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.df-leaderboard-row {
    background: var(--df-surface);
    border: 1px solid var(--df-border);
    border-radius: 12px;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

/* Left side: Rank & User */
.df-l-left {
    display: flex;
    align-items: center;
    gap: 24px;
    flex: 1;
}

.df-l-rank {
    font-size: 24px;
    font-weight: 800;
    color: var(--df-text);
    min-width: 24px;
}

.df-l-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.df-l-user img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.df-l-user span {
    font-size: 16px;
    font-weight: 600;
    color: var(--df-text);
}

/* Right side: Stats, Artworks, Actions */
.df-l-right {
    display: flex;
    align-items: center;
    gap: 32px;
}

.df-l-stats {
    display: flex;
    align-items: center;
    gap: 24px;
    color: var(--df-text-muted);
    font-size: 13px;
    font-weight: 500;
}

.df-l-stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.df-l-stat svg {
    color: var(--df-text-muted);
}

.df-l-artworks {
    display: flex;
    align-items: center;
    gap: 6px;
}

.df-l-artworks img {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    object-fit: cover;
}

.df-l-more {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    background: #e2e8f0;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.df-l-follow-btn {
    background: #0f172a;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.df-l-follow-btn:hover {
    background: #1e293b;
}

/* Leaderboard Responsive */
@media (max-width: 900px) {
    .df-leaderboard-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .df-l-right {
        width: 100%;
        justify-content: space-between;
        gap: 16px;
        flex-wrap: wrap;
    }
}
@media (max-width: 600px) {
    .df-l-stats {
        width: 100%;
        justify-content: center;
    }
    .df-l-artworks {
        width: 100%;
        justify-content: center;
    }
    .df-l-follow-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================
   MOBILE RESPONSIVE (≤768px)
   ============================ */

/* Mobile header — hidden on desktop */
.df-mobile-header,
.df-mobile-search-bar,
.df-mobile-backdrop,
.df-mobile-settings-wrapper,
.df-mobile-settings-sheet {
    display: none;
}

@media (max-width: 768px) {

    /* --- BODY & APP CONTAINER --- */
    body.df-body {
        overflow: auto;
    }

    .df-app {
        flex-direction: column;
        padding: 0;
        gap: 0;
        height: auto;
        min-height: 100vh;
    }

    /* --- MOBILE HEADER (toolbar-style) --- */
    .df-mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 16px;
        margin: 0 12px 0;
        background: var(--df-surface);
        border-radius: var(--df-radius-lg);
        box-shadow: 0 4px 20px rgba(0,0,0,0.03);
        position: sticky;
        top: 4px;
        z-index: 1000;
        min-height: 48px;
        box-sizing: border-box;
    }

    .df-mobile-menu-btn {
        background: none;
        border: none;
        padding: 4px;
        margin-right: 4px;
        color: var(--df-text-main);
        cursor: pointer;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .df-mobile-menu-btn:active { background: rgba(0,0,0,0.06); }

    .df-mobile-logo {
        display: flex;
        align-items: center;
        gap: 6px;
        text-decoration: none;
        color: var(--df-text-main);
        font-size: 15px;
        margin-right: auto;
    }
    .df-mobile-logo strong { font-weight: 700; }
    .df-mobile-logo span { font-weight: 400; }

    .df-mobile-actions {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .df-mobile-icon-btn {
        background: none;
        border: none;
        padding: 8px;
        color: var(--df-text-main);
        cursor: pointer;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
    }
    .df-mobile-icon-btn:active { background: rgba(0,0,0,0.06); }

    .df-mobile-cart-badge {
        position: absolute;
        top: 2px;
        right: 2px;
        background: #ef4444;
        color: #fff;
        font-size: 9px;
        font-weight: 700;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px solid var(--df-surface);
    }

    /* --- MOBILE SEARCH BAR --- */
    .df-mobile-search-bar {
        display: none;
        position: fixed;
        top: 64px;
        left: 12px;
        right: 12px;
        z-index: 999;
        background: var(--df-surface);
        border-bottom: 1px solid var(--df-border);
        padding: 8px 16px 12px;
        box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    }
    .df-mobile-search-bar.df-active { display: block; }

    .df-mobile-search-inner {
        display: flex;
        align-items: center;
        gap: 8px;
        background: var(--df-bg-sidebar);
        border: 1px solid var(--df-border);
        border-radius: 12px;
        padding: 10px 14px;
    }
    .df-mobile-search-inner input {
        border: none;
        outline: none;
        background: transparent;
        flex: 1;
        font-size: 15px;
        color: var(--df-text-main);
        font-family: var(--df-font);
    }
    .df-mobile-search-inner button {
        background: none;
        border: none;
        color: var(--df-text-muted);
        font-size: 16px;
        cursor: pointer;
        padding: 4px;
    }

    #df-mobile-search-results {
        max-height: 60vh;
        overflow-y: auto;
        margin-top: 4px;
    }

    /* --- BACKDROP --- */
    .df-mobile-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.2);
        z-index: 998;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    .df-mobile-backdrop.df-active {
        display: block;
        opacity: 1;
    }

    /* --- SIDEBAR AS POPOVER DROPDOWN BELOW HEADER --- */
    .df-sidebar {
        position: fixed;
        top: 52px;
        left: 12px;
        right: 12px;
        bottom: auto;
        width: auto;
        max-height: 70vh;
        z-index: 1001;
        border-radius: 0 0 var(--df-radius-lg) var(--df-radius-lg);
        box-shadow: 0 12px 48px rgba(0,0,0,0.15);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
        pointer-events: none;
        padding-top: 8px;
    }
    .df-sidebar.df-mobile-open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }

    /* Hide logo in popover — already shown in header pill */
    .df-sidebar .df-logo {
        display: none;
    }

    /* When sidebar is open, merge header pill bottom with popover top */
    .df-mobile-header:has(~ .df-sidebar.df-mobile-open),
    .df-mobile-header.df-menu-active {
        border-radius: var(--df-radius-lg) var(--df-radius-lg) 0 0;
        box-shadow: none;
    }

    /* --- HIDE DESKTOP TOPBAR --- */
    .df-topbar {
        display: none !important;
    }

    /* --- MAIN CONTENT --- */
    .df-main {
        flex: 1;
        overflow: visible;
        padding-top: 0;
    }
    /* Top fade — starts just below the header pill, NOT covering status bar */
    .df-main::before {
        content: '';
        position: fixed;
        top: 46px;
        left: 0;
        right: 0;
        height: 30px;
        background: linear-gradient(to bottom, var(--df-bg-main), transparent);
        z-index: 15;
        pointer-events: none;
    }
    /* Bottom fade — tall enough to cover iOS safe area + toolbar */
    .df-main::after {
        content: '';
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 100px;
        background: linear-gradient(to top,
            var(--df-bg-main) 0%,
            var(--df-bg-main) 30%,
            rgba(240,242,245,0) 100%
        );
        z-index: 10;
        pointer-events: none;
    }

    .df-content {
        padding: 12px 12px 140px;
        overflow: visible;
    }

    /* --- GRID: 50/50 + 100% repeating pattern --- */
    .df-masonry {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-gap: 10px;
        grid-auto-rows: auto;
    }
    .df-masonry-item {
        grid-column: auto;
        grid-row: auto;
        border-radius: 12px;
        aspect-ratio: 0.85;
        overflow: hidden;
        touch-action: manipulation;
    }
    .df-masonry-item .df-masonry-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    /* Every 3rd item = full width */
    .df-masonry-item:nth-child(3n+3) {
        grid-column: 1 / -1;
        aspect-ratio: 1.2;
    }

    /* Reset desktop scale transforms on mobile */
    .df-masonry-item:nth-child(3n+1) .df-masonry-img,
    .df-masonry-item:nth-child(3n) .df-masonry-img {
        transform: none;
    }

    /* --- CARD OVERLAY: hidden by default, show on TAP --- */
    .df-masonry-overlay {
        opacity: 0;
        transition: opacity 0.25s ease;
        padding: 10px;
    }
    .df-masonry-item.df-tapped .df-masonry-overlay {
        opacity: 1;
    }
    .df-masonry-overlay .df-user-badge {
        font-size: 11px;
        max-width: 60%;
        overflow: hidden;
    }
    .df-masonry-overlay .df-user-badge img { width: 20px; height: 20px; }
    .df-masonry-overlay .df-user-badge span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 70px;
        display: inline-block;
        vertical-align: middle;
    }
    /* Hide duplicate/copy button on mobile */
    .df-masonry-overlay .df-action-icons button[title="Copy"] {
        display: none;
    }
    .df-masonry-item { border-radius: 12px; }

    /* Card tags */
    .df-card-tags { gap: 4px; }
    .df-card-tag { font-size: 10px; padding: 3px 8px; }

    /* --- CATEGORY ROW --- */
    .df-categories-wrapper { margin-bottom: 20px; }
    .df-categories-row { gap: 10px; }
    .df-cat-card {
        min-width: 140px;
        flex: 0 0 auto;
        padding: 10px;
        gap: 8px;
    }
    .df-cat-img { width: 28px; height: 28px; }
    .df-cat-text strong { font-size: 13px; }
    .df-cat-text span { font-size: 11px; }
    .df-cat-nav { display: none !important; }

    /* --- FLOATING PROMPT --- */
    .df-prompt-container {
        position: fixed;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        left: 12px;
        right: 12px;
        transform: none;
        width: auto;
        max-width: none;
        z-index: 20;
    }
    .df-prompt-inner {
        border-radius: 18px;
        padding: 12px 14px;
        gap: 10px;
    }
    .df-prompt-input-wrapper input { font-size: 15px; }

    /* --- DESIGN DETAIL --- */
    .df-detail-back { padding: 12px 12px 0; }
    .df-detail-layout {
        flex-direction: column;
        padding: 12px;
        gap: 20px;
    }
    .df-detail-sidebar {
        max-width: 100%;
        min-width: 0;
    }
    .df-detail-hero {
        padding: 20px;
        border-radius: 16px;
    }
    .df-detail-hero-img {
        max-height: 400px;
    }
    .df-detail-title { font-size: 20px; }
    .df-detail-more-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* --- BROWSE GRID --- */
    .df-browse-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* --- SEARCH DROPDOWN (desktop) --- */
    #df-search-results {
        width: 100% !important;
        left: 0 !important;
    }

    /* --- PROFILE & CART POPOVER MOBILE --- */
    .df-profile-popover,
    .df-cart-popover {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        border-radius: 20px 20px 0 0 !important;
        max-height: 70vh;
        overflow-y: auto;
    }

    /* --- LEADERBOARD --- */
    .df-leaderboard-row { padding: 14px 16px; }
    .df-l-left { gap: 12px; }
    .df-l-user img { width: 36px; height: 36px; }
    .df-l-user span { font-size: 14px; }
    .df-l-rank { font-size: 18px; }

    /* --- PRODUCT DETAIL --- */
    .df-detail-more { padding: 0 0 30px; }

    /* Hide desktop-only elements */
    .df-arrow { display: none; }
    .df-status { display: none; }

    /* --- PROMPT BAR MOBILE --- */
    /* Hide the 3 desktop pill selects, show settings gear instead */
    .df-casetype-wrapper,
    .df-finish-wrapper,
    .df-model-wrapper,
    .df-actions-right .df-action-btn.df-icon-only { display: none !important; }

    .df-mobile-settings-wrapper { display: block; }

    .df-prompt-actions {
        flex-wrap: nowrap;
        gap: 6px;
    }
    .df-actions-left { gap: 6px; }
    .df-actions-right { gap: 6px; }

    /* --- SETTINGS POPOVER (bottom sheet) --- */
    .df-mobile-settings-sheet {
        display: none;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--df-surface);
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 32px rgba(0,0,0,0.12);
        padding: 20px 16px calc(env(safe-area-inset-bottom, 12px) + 12px);
        z-index: 2000;
        animation: dfSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .df-mobile-settings-sheet.df-active { display: block; }

    @keyframes dfSlideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .df-mobile-settings-title {
        font-size: 16px;
        font-weight: 700;
        color: var(--df-text-main);
        margin-bottom: 16px;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--df-border);
    }

    .df-mobile-setting-row {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        padding: 14px 12px;
        background: none;
        border: none;
        border-radius: 12px;
        cursor: pointer;
        font-family: var(--df-font);
        transition: background 0.15s;
        text-align: left;
        color: var(--df-text-main);
    }
    .df-mobile-setting-row:active { background: rgba(0,0,0,0.04); }

    .df-mobile-setting-row svg:first-child {
        color: var(--df-text-muted);
        flex-shrink: 0;
    }
    .df-mobile-setting-row svg:last-child {
        color: var(--df-text-muted);
        flex-shrink: 0;
        margin-left: auto;
    }

    .df-ms-label {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    .df-ms-key {
        font-size: 11px;
        font-weight: 600;
        color: var(--df-text-muted);
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .df-ms-value {
        font-size: 15px;
        font-weight: 600;
        color: var(--df-text-main);
    }

    /* Popovers that open from settings => fixed bottom sheets */
    .df-upload-popover.df-popover-open,
    .df-model-popover.df-popover-open {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        border-radius: 20px 20px 0 0 !important;
        z-index: 2001 !important;
        box-shadow: 0 -8px 32px rgba(0,0,0,0.12) !important;
        padding-bottom: calc(env(safe-area-inset-bottom, 12px) + 12px) !important;
    }
}

/* Tablet tweaks (769px – 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .df-sidebar { width: 220px; }
    .df-app { padding: 12px 16px; gap: 16px; }
    .df-masonry {
        grid-template-columns: repeat(2, 1fr);
        grid-gap: 16px;
    }
    .df-masonry-item:nth-child(3n+1),
    .df-masonry-item:nth-child(3n+2),
    .df-masonry-item:nth-child(3n) {
        grid-column: auto;
        grid-row: span 6;
    }
    .df-search { width: 220px; }
}

/* === WooCommerce Checkout: 50/50 field pairs === */
.woocommerce form .form-row#billing_first_name_field,
.woocommerce form .form-row#shipping_first_name_field,
.woocommerce form .form-row#billing_postcode_field,
.woocommerce form .form-row#shipping_postcode_field {
    float: left !important;
    width: 48% !important;
    clear: left !important;
    margin-right: 4% !important;
}
.woocommerce form .form-row#billing_last_name_field,
.woocommerce form .form-row#shipping_last_name_field,
.woocommerce form .form-row#billing_city_field,
.woocommerce form .form-row#shipping_city_field {
    float: right !important;
    width: 48% !important;
    clear: right !important;
    margin-right: 0 !important;
}
@media (max-width: 480px) {
    .woocommerce form .form-row#billing_first_name_field,
    .woocommerce form .form-row#billing_last_name_field,
    .woocommerce form .form-row#shipping_first_name_field,
    .woocommerce form .form-row#shipping_last_name_field,
    .woocommerce form .form-row#billing_postcode_field,
    .woocommerce form .form-row#billing_city_field,
    .woocommerce form .form-row#shipping_postcode_field,
    .woocommerce form .form-row#shipping_city_field {
        float: none !important;
        width: 100% !important;
        margin-right: 0 !important;
    }
}
