/**
 * Agency Frontend Styles
 * Style moderne et épuré pour l'interface client
 */

/* Force emoji to use system fonts to prevent loading flash */
.agency-emoji-display,
.agency-emoji-option,
.emoji-display {
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', sans-serif !important;
}

/* Variables CSS */
:root {
    --agency-primary-color: #000000;
    --agency-secondary-color: #ffffff;
    --agency-text-color: #333333;
    --agency-text-muted: #6b7280;
    --agency-light-bg: #f8f9fa;
    --agency-border-color: #e0e0e0;
    --agency-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --agency-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
    --agency-shadow-strong: 0 4px 20px rgba(0, 0, 0, 0.12);
    --agency-radius: 25px;
    --agency-radius-small: 12px;
    --agency-transition: all 0.3s ease;
    --agency-header-bg: rgba(255, 255, 255, 0.85);
    --agency-header-height: 70px;
}

/* Fix horizontal scroll on mobile caused by blur elements */
body {
    width: 100%;
    position: relative;
}

/* =======================================================
   MODE SOMBRE — Variables de couleurs injectées dynamiquement par PHP.
   Voir Agency_Frontend::load_global_branding()
   ======================================================= */

.agency-theme-dark .project-description,
.agency-theme-dark .block-text-content,
.agency-theme-dark .comment-content,
.agency-theme-dark .asset-name,
.agency-theme-dark .media-filename {
    color: var(--agency-text-color);
}

.agency-theme-dark .project-card-header .project-name-badge {
    background: #1f2937;
}

.agency-theme-dark a {
    color: #ffffff;
}

.agency-theme-dark a:hover {
    color: #ffffff90;
}

/* Reset & Base */
.agency-wrapper {
    color: var(--agency-text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--agency-light-bg);
}

.agency-wrapper * {
    box-sizing: border-box;
}

/* Container */
.agency-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ========================================
   MODERN FIXED HEADER
   ======================================== */
.agency-header-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--agency-header-height);
    background: var(--agency-header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--agency-shadow);
    z-index: 99990;
    transition: var(--agency-transition);
}

.agency-header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.agency-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.agency-header-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
    transition: var(--agency-transition);
}

.agency-header-logo:hover {
    transform: scale(1.05);
}

.agency-header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    pointer-events: none;
}

.agency-header-center img {
    pointer-events: auto;
}

.agency-header-client-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--agency-text-color);
    white-space: nowrap;
}

.agency-header-right {
    display: flex;
    align-items: center;
    gap: 30px;
}

.agency-header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.breadcrumb-item {
    color: var(--agency-text-color);
    text-decoration: none;
    transition: var(--agency-transition);
    white-space: nowrap;
}

.breadcrumb-link:hover {
    color: var(--agency-primary-color);
}

.breadcrumb-current {
    font-weight: 600;
}

.breadcrumb-separator {
    color: var(--agency-text-muted);
    opacity: 0.5;
}

.agency-header-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-display-name {
    font-size: 14px;
    color: var(--agency-text-muted);
}

.agency-header-logout {
    font-size: 14px;
    color: var(--agency-text-color);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--agency-radius-small);
    background: var(--agency-light-bg);
    border: 1px solid var(--agency-border-color);
    transition: var(--agency-transition);
}

.agency-header-logout:hover {
    background: var(--agency-primary-color);
    color: #ffffff;
    border-color: var(--agency-primary-color);
}

/* Spacer to compensate for fixed header */
.agency-header-spacer {
    height: var(--agency-header-height);
}

/* Responsive Header */
@media (max-width: 768px) {
    .agency-header-container {
        padding: 0 15px;
    }
    
    .agency-header-client-name {
        font-size: 16px;
        display: none;
    }
    
    .agency-header-breadcrumb {
        display: none;
    }
    
    .user-display-name {
        display: none;
    }
    
    .agency-header-right {
        gap: 10px;
    }
}

/* ========================================
   OLD HEADER STYLES (Legacy - to deprecate)
   ======================================== */
.agency-header {
    color: #FFFFFF;
    padding: 20px 50px;
    border-radius: 25px 25px 25px 25px;
    margin: 10px 50px 10px 50px;
    box-shadow: var(--agency-shadow);
}

.agency-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.agency-logo {
    max-height: 50px;
    height: auto;
    display: block;
    margin: 12px auto 0;
}

.agency-client-name {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.agency-breadcrumb {
    font-size: 16px;
}

.agency-breadcrumb a {
    color: #FFFFFF;
    text-decoration: none;
    opacity: 0.8;
    transition: var(--agency-transition);
}

.agency-breadcrumb a:hover {
    opacity: 1;
}

.agency-breadcrumb .separator {
    margin: 0 10px;
    opacity: 0.5;
}

.agency-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.agency-user-info {
    font-size: 14px;
    opacity: 0.9;
}

.agency-logout {
    color: var(--agency-secondary-color);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--agency-radius);
    background: rgba(255, 255, 255, 0.1);
    transition: var(--agency-transition);
}

.agency-logout:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Main */
.agency-main {
    flex: 1;
    padding: 40px 0;
    background: var(--agency-light-bg);
    position: relative;
    z-index: 1; /* Restored */
}

.agency-title {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 30px;
    padding: 30px 0px 30px 0px;
    color: var(--agency-text-color);
    border: 1px solid var(--agency-primary-color);
    border-radius: var(--agency-radius);
    text-align: center;
}

.agency-title-edit {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
}

.agency-title[contenteditable="true"] {
    outline: none;
    cursor: text;
    padding: 3%;
}

.agency-title[contenteditable="true"]:focus {
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.agency-title.is-saving {
    opacity: 0.7;
}

.agency-title-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.agency-title-status {
    font-size: 13px;
    color: var(--agency-text-muted);
}

.agency-title-status.success {
    color: #16a34a;
}

.agency-title-status.error {
    color: #dc2626;
}

.agency-subtitle {
    font-size: 14px;
    font-weight: 400;
    color: var(--agency-text-muted);
    margin-top: -20px;
    margin-bottom: 30px;
    text-align: center;
}

.agency-subtitle-editable {
    cursor: text;
    outline: none;
    border-radius: 4px;
    padding: 2px 6px;
    margin-left: -6px;
    transition: background 0.2s;
}

.agency-subtitle-editable:hover {
    background: rgba(0, 0, 0, 0.04);
}

.agency-subtitle-editable:focus {
    background: rgba(0, 0, 0, 0.06);
    box-shadow: 0 0 0 2px var(--agency-primary-color);
}

.agency-theme-dark .agency-subtitle-editable:hover {
    background: rgba(255, 255, 255, 0.06);
}

.agency-theme-dark .agency-subtitle-editable:focus {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 2px var(--agency-primary-color);
}

/* Buttons */
.agency-btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: var(--agency-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--agency-transition);
    text-decoration: none;
    text-align: center;
}

.agency-btn-primary {
    background: var(--agency-primary-color);
    color: #FFFFFF;
}

.agency-btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: var(--agency-shadow);
}

.agency-btn-secondary {
    background: var(--agency-light-bg);
    color: var(--agency-text-color);
    border: 1px solid var(--agency-border-color);
}

.agency-btn-secondary:hover {
    background: #e9ecef;
}


.agency-btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: inherit;
    line-height: 1;
    padding: 5px;
    transition: var(--agency-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.agency-btn-icon:hover {
    transform: scale(1.2);
}

/* SVG icon base styles */
.agency-icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.agency-btn .agency-icon {
    margin-right: 4px;
}

.agency-btn-icon .agency-icon {
    width: 18px;
    height: 18px;
}

/* Lazy loading backgrounds */
[data-bg-lazy] {
    background-color: var(--agency-light-bg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

[data-bg-lazy].bg-loaded {
    animation: agency-fade-in 0.3s ease;
}

@keyframes agency-fade-in {
    from { opacity: 0.7; }
    to { opacity: 1; }
}

.agency-btn-text {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 5px 10px;
    font-size: 13px;
    transition: var(--agency-transition);
}

.agency-btn-text:hover {
    text-decoration: underline;
}

/* Actions */
.agency-actions {
    margin-bottom: 30px;
    display: flex;
    gap: 10px;
}

.agency-form-inline {
    display: flex;
    gap: 10px;
    align-items: center;
}

.agency-image-preview {
    margin-top: 10px;
}

.agency-image-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    border: 1px solid var(--agency-border-color);
}

/* Projects Grid */
.agency-projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.agency-project-card-link,
.agency-project-card-link:hover,
.agency-project-card-link:focus,
.agency-project-card-link:active {
    text-decoration: none !important;
    display: block;
    color: inherit;
}

.agency-project-card {
    background: white;
    border-radius: var(--agency-radius);
    padding: 24px;
    box-shadow: var(--agency-shadow);
    transition: var(--agency-transition);
    border: 1px solid var(--agency-border-color);
    min-height: 280px;
    display: flex;
    flex-direction: column;
}

.agency-project-card.has-project-bg {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    color: #ffffff;
    overflow: hidden;
}

.agency-project-card.has-project-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 0;
}

.agency-project-card.has-project-bg > * {
    position: relative;
    z-index: 1;
}

.agency-project-card.has-project-bg .project-description,
.agency-project-card.has-project-bg .blocks-title,
.agency-project-card.has-project-bg .block-type-small,
.agency-project-card.has-project-bg .block-title-small,
.agency-project-card.has-project-bg .project-date {
    color: rgba(255, 255, 255, 0.85);
}

.agency-project-card.has-project-bg .project-blocks-list {
    background: rgba(0, 0, 0, 0.35);
}

.agency-project-card:hover {
    box-shadow: var(--agency-shadow-hover);
    transform: translateY(-4px) scale(1.03);
}

/* Icones edit/delete en blanc sur les cards projet et blocs */
.agency-project-card .agency-btn-icon {
    color: #fff;
}

.agency-project-card .agency-btn-icon:hover {
    color: rgba(255, 255, 255, 0.7);
}

.block-actions .agency-btn-icon {
    color: #fff;
}

.block-actions .agency-btn-icon:hover {
    color: rgba(255, 255, 255, 0.7);
}

.project-title {
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 600;
}

.project-title a {
    color: var(--agency-text-color);
    text-decoration: none;
}

.project-title a:hover {
    color: var(--agency-primary-color);
}

.project-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 16px;
}

.project-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--agency-border-color);
}

.project-card-header {
    margin-bottom: 12px;
}

.project-name-badge {
    display: inline-block;
    font-size: 24px;
    color: #FFFFFF;
    padding: 4px 20px;
    border-radius: 12px;
    letter-spacing: 0.5px;
    border: 1px solid #ffffff20;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-sizing: border-box;
}

/* Hide badge when no cover image; hide title when cover present */
.agency-project-card:not(.has-project-bg) .project-name-badge {
    display: none;
}

.agency-project-card.has-project-bg .project-title {
    display: none;
}

/* Force title visibility on cards without cover (theme override protection) */
.agency-project-card:not(.has-project-bg) .project-title {
    display: block !important;
    background: transparent;
}

.project-blocks-list {
    margin: 16px 0;
    padding: 12px;
    background: var(--agency-light-bg);
    border-radius: calc(var(--agency-radius) * 0.5);
}

.blocks-title {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: #666;
}

.blocks-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.block-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
}

.block-item:not(:last-child) {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.block-type-small {
    display: inline-block;
    background: var(--agency-primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.block-title-small {
    color: #ffffff;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-date {
    font-size: 12px;
    color: #999;
}

/* Blocks Grid Layout */
.agency-blocks-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 30px;
    grid-auto-rows: auto;
    grid-auto-flow: dense;
}

.agency-block {
    background: white;
    border-radius: var(--agency-radius);
    padding: 24px;
    box-shadow: var(--agency-shadow);
    position: relative;
    transition: all 0.2s ease;
    border: 1px solid var(--agency-border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: calc(var(--agency-grid-height, 1) * 300px + (max(1, var(--agency-grid-height, 1)) - 1) * 20px);
}

/* Blocks with background image */
.agency-block.has-block-bg {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    color: #ffffff;
    overflow: hidden;
}

.agency-block-card.has-block-bg {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.agency-block.has-block-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 0;
}

.agency-block.has-block-bg > * {
    position: relative;
    z-index: 1;
}

.agency-block.has-block-bg .block-type-badge,
.agency-block.has-block-bg .block-title,
.agency-block.has-block-bg .block-snippet,
.agency-block.has-block-bg .agency-btn {
    color: #ffffff;
}

.agency-block.has-block-bg .block-snippet {
    color: rgba(255, 255, 255, 0.85);
}

.agency-block.has-block-bg .agency-btn-sm {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.agency-block.has-block-bg .agency-btn-sm:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.agency-block.has-block-bg .block-separator {
    background: rgba(255, 255, 255, 0.2);
}

.agency-block.has-block-bg .comments-badge {
    background: rgba(255, 255, 255, 0.9);
    color: #000;
}

.agency-block.has-block-bg .block-preview-media {
    display: none; /* Hide inline preview when using as background */
}


.agency-block .block-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    overflow: hidden;
    padding-bottom: 70px; /* Espace pour le footer positionné en bas */
}

.sortable.agency-blocks-grid .agency-block {
    cursor: grab;
}

.sortable.agency-blocks-grid .agency-block:active {
    cursor: grabbing;
}

/* Drag and Drop Animations */
.sortable.agency-blocks-grid .agency-block:hover {
    box-shadow: var(--agency-shadow-hover);
    transform: translateY(-2px);
}

.agency-blocks-grid .sortable-ghost {
    opacity: 0.4;
    background: var(--agency-light-bg);
}

.agency-blocks-grid .sortable-drag {
    opacity: 0.9;
    transform: rotate(2deg) scale(1.02);
    box-shadow: var(--agency-shadow-strong);
    z-index: 1000;
}

/* Resize Icon */
.block-resize-icon {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: nwse-resize;
    font-size: 18px;
    z-index: 100; /* Au-dessus du footer */
    transition: all 0.2s ease;
    user-select: none;
    opacity: 0.7;
}

.block-resize-icon:hover {
    background: var(--agency-primary-color);
    opacity: 1;
    transform: scale(1.1);
}

/* Forcer l'icône de resize à rester en bas à droite sur les cartes avec fond */
.agency-block.has-block-bg .block-resize-icon {
    position: absolute;
    bottom: 8px;
    right: 8px;
    left: auto;
    z-index: 100;
}

/* Resizing state */
.agency-block.is-resizing {
    box-shadow: var(--agency-shadow-strong);
    border-color: var(--agency-primary-color);
    z-index: 999;
}

.agency-block.is-resizing .block-resize-icon {
    background: var(--agency-primary-color);
    opacity: 1;
}

/* Mobile: Full width single column */
@media (max-width: 1024px) {
    .agency-blocks-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
    }

    .agency-block {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
        min-height: 200px;
    }

    .block-resize-icon {
        display: none;
    }
}

.block-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.block-header-full {
    background: white;
    border-radius: var(--agency-radius);
    padding: 24px;
    box-shadow: var(--agency-shadow);
    margin-bottom: 30px;
    border: 1px solid var(--agency-border-color);
}

.block-project-name {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    background: var(--agency-light-bg);
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.block-type-badge {
    color: var(--agency-primary-color);
    border: 1px solid var(--agency-primary-color);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
    margin-bottom: 12px;
    align-self: flex-start;
}

.block-title {
    margin: 0 0 16px 0;
    font-size: 22px;
    font-weight: 600;
    display: block;
    color: var(--agency-text-color);
}

.block-separator {
    height: 1px;
    background: var(--agency-border-color);
    margin: 16px 0;
}

.block-snippet {
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    margin: 16px 0;
}

.block-preview-media {
    position: relative;
    width: 100%;
    height: 200px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--agency-light-bg);
    margin: 16px 0;
}

.block-preview-media .preview-image,
.block-preview-media .preview-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.block-preview-media .media-count {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.version-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.block-content {
    margin: 16px 0;
    font-size: 14px;
    line-height: 1.6;
}

.block-content-full {
    background: white;
    border-radius: var(--agency-radius);
    padding: 24px;
    box-shadow: var(--agency-shadow);
    margin-bottom: 30px;
}

.block-text-content {
    font-size: 15px;
    line-height: 1.8;
    color: var(--agency-text-color);
    margin-bottom: 20px;
}

.block-footer {
    position: absolute;
    bottom: 42px; /* Juste au-dessus de la poignée de resize (8px + 28px + 6px) */
    left: 24px;
    right: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--agency-border-color);
    background: white;
    z-index: 50;
}

/* Fond semi-transparent pour le footer sur les cards avec image de fond */
.agency-block.has-block-bg .block-footer {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    padding: 12px;
    margin: 0 -12px;
    left: 12px;
    right: 12px;
    bottom: 18px; /* Ajustement par rapport au padding du parent qui est de 24px (42 - 24 = 18) */
    border-radius: 24px;
    border-top: none;
}

/* Footer en mode sombre */
.agency-theme-dark .block-footer {
    background: #111827;
}

.agency-theme-dark .agency-block.has-block-bg .block-footer {
    background: rgba(17, 24, 39, 0.5);
}

.block-actions {
    display: flex;
    gap: 8px;
}

.comments-badge {
    background: #ff4444;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    margin-left: 5px;
}

/* Assets */
.assets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.asset-item {
    background: var(--agency-light-bg);
    border-radius: var(--agency-radius);
    padding: 12px;
    text-align: center;
}

.asset-item img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 8px;
}

.asset-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.asset-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.asset-name {
    font-size: 13px;
    font-weight: 500;
    word-break: break-word;
}

.asset-size {
    font-size: 11px;
    color: #999;
}

.asset-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

/* Comments */
.block-comments {
    background: white;
    border-radius: var(--agency-radius);
    padding: 24px;
    box-shadow: var(--agency-shadow);
    margin-top: 30px;
}

.comments-list {
    margin: 20px 0;
}

.comment-item {
    padding: 16px;
    border-bottom: 1px solid var(--agency-border-color);
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.comment-author {
    font-weight: 600;
    font-size: 14px;
}

.comment-date {
    font-size: 12px;
    color: #999;
}

.comment-content {
    font-size: 14px;
    line-height: 1.6;
}

.comment-form {
    margin-top: 30px;
}

.comment-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--agency-border-color);
    border-radius: var(--agency-radius);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

.comment-form button {
    margin-top: 12px;
}

/* Empty State */
.agency-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
}

/* Footer */
.agency-footer {
    color: #1e293b;
    padding: 20px 0;
    text-align: center;
    margin-top: auto;
    position: relative;
    /* z-index removed to prevent it overlaying modals */
}

.agency-footer p {
    margin: 0;
    font-size: 14px;
}

/* Two-Column Layout (2/3 + 1/3) for Script Block */
.block-two-column-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-top: 30px;
}

.block-column-left {
    background: white;
    border-radius: var(--agency-radius);
    padding: 24px;
    box-shadow: var(--agency-shadow);
}

.block-column-right {
    background: white;
    border-radius: var(--agency-radius);
    padding: 24px;
    box-shadow: var(--agency-shadow);
}

/* Script Editor Styles */
.script-editor-section h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--agency-text-color);
}

.script-editor-wrapper {
    width: 100%;
}

.script-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px;
    background: var(--agency-light-bg);
    border: 1px solid var(--agency-border-color);
    border-radius: 8px;
}

.script-toolbar .toolbar-btn {
    padding: 8px 12px;
    background: var(--agency-secondary-color);
    border: 1px solid var(--agency-border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: var(--agency-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
}

.script-toolbar .toolbar-btn:hover {
    background: var(--agency-primary-color);
    color: white;
    border-color: var(--agency-primary-color);
    transform: translateY(-2px);
}

.script-toolbar .toolbar-btn:active {
    transform: translateY(0);
}

.script-highlight-comment {
    background-color: #fbbf24 !important;
    padding: 2px 0 !important;
    position: relative;
    cursor: help;
    border-bottom: 2px dotted #f59e0b;
}

.script-highlight-comment:hover {
    background-color: #f59e0b !important;
}

.script-editor {
    width: 100%;
    min-height: 500px;
    padding: 16px;
    border: 1px solid var(--agency-border-color);
    border-radius: 12px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.8;
    resize: vertical;
    background: #fafafa;
    transition: var(--agency-transition);
}

.script-editor:focus {
    outline: none;
    border-color: var(--agency-primary-color);
    background: var(--agency-border-color);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.script-content-display {
    padding: 16px;
    background: #fafafa;
    border-radius: 12px;
    min-height: 300px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.script-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
}

.script-save-status {
    font-size: 14px;
    color: #666;
}

.script-save-status.success {
    color: #28a745;
}

.script-save-status.error {
    color: #dc3545;
}

.no-content {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 40px;
}

/* Storyboard Styles */
.storyboard-content {
    margin-top: 30px;
}

.storyboard-description {
    margin-bottom: 12px;
}

/* Storyboard Items Container */
.storyboard-items {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.storyboard-items.sortable .storyboard-item {
    cursor: move;
}

.storyboard-items.sortable .storyboard-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Storyboard Item avec animations smooth */
.storyboard-item {
    background: white;
    border-radius: var(--agency-radius);
    padding: 24px;
    box-shadow: var(--agency-shadow);
    display: grid;
    grid-template-columns: 70% 30%;
    gap: 30px;
    align-items: start;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 1px solid var(--agency-border-color);
}

/* Animations de drag & drop pour storyboard */
.storyboard-items .sortable-ghost {
    opacity: 0.3;
    background: var(--agency-light-bg);
}

.storyboard-items .sortable-drag {
    opacity: 0.9;
    transform: rotate(1deg) scale(1.02);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    cursor: grabbing;
}

.storyboard-items .sortable-chosen {
    background: var(--agency-light-bg);
    border: 2px dashed var(--agency-primary-color);
}

/* Animation d'entrée pour nouveaux items */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.storyboard-item {
    animation: slideInUp 0.4s ease;
}

/* Transition fluide lors du réarrangement */
.storyboard-items.sortable .storyboard-item {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s ease,
                opacity 0.3s ease;
}

/* Storyboard Media (Left Column) */
.storyboard-media {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.storyboard-image,
.storyboard-video {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.storyboard-file-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--agency-light-bg);
    border-radius: 8px;
    text-align: center;
}

.storyboard-file-icon .file-icon {
    font-size: 64px;
    margin-bottom: 12px;
}

.storyboard-file-icon .file-name {
    font-size: 14px;
    font-weight: 500;
    word-break: break-word;
}

.storyboard-media-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
}

.media-filename {
    font-size: 13px;
    font-weight: 500;
    color: #666;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-actions {
    display: flex;
    gap: 8px;
}

/* Storyboard Comments (Right Column) */
.storyboard-comments {
    padding-right: 20px;
}


.storyboard-comments h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--agency-text-color);
}

.asset-comments-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding-right: 8px;
}

.asset-comments-list::-webkit-scrollbar {
    width: 6px;
}

.asset-comments-list::-webkit-scrollbar-track {
    background: var(--agency-light-bg);
    border-radius: 3px;
}

.asset-comments-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.asset-comments-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.asset-comments-list .comment-item {
    background: var(--agency-light-bg);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    border: none;
}

.asset-comments-list .comment-header {
    margin-bottom: 6px;
}

.asset-comments-list .comment-content {
    font-size: 13px;
}

.comment-delete-btn {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 11px;
    cursor: pointer;
    padding: 4px 0;
    margin-top: 4px;
    text-decoration: underline;
}

.comment-delete-btn:hover {
    color: #c82333;
}

.asset-comment-form {
    border-top: 1px solid var(--agency-border-color);
    padding-top: 16px;
}

.asset-comment-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--agency-border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
    margin-bottom: 8px;
}

.asset-comment-input:focus {
    outline: none;
    border-color: var(--agency-primary-color);
}

.agency-btn-sm {
    background-color: var(--agency-primary-color);
    color: white;
    padding: 8px 16px;
    font-size: 13px;
}

.agency-btn-sm:hover {
    opacity: 0.9;
}
.no-assets,
.no-comments {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
    font-style: italic;
}

/* Upload Progress */
.upload-progress {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    z-index: 99999;
    font-size: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Responsive */
@media (max-width: 1024px) {
    .block-two-column-layout {
        grid-template-columns: 1fr;
    }
    
    .storyboard-item {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .agency-header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .agency-projects-grid {
        grid-template-columns: 1fr;
    }
    
    .agency-title {
        font-size: 24px;
    }
    
    .agency-actions {
        flex-direction: column;
    }
    
    .block-column-left,
    .block-column-right {
        padding: 16px;
    }
    
    .script-editor {
        min-height: 300px;
    }
}


.blur-1 {
    background: var(--agency-primary-color);
    opacity: 0.5;
    width: 400px;
    height: 400px;
    position: absolute;
    top: 1200px;
    left: 1600px;
    border-radius: 1000px;
    filter: blur(1000px);
    z-index: -10;
    animation: grow-shrink 10s infinite ease-in-out;
}

.blur-2 {
    background: var(--agency-primary-color);
    opacity: 0.5;
    width: 400px;
    height: 400px;
    position: absolute;
    top: 0px;
    left: 0px;
    border-radius: 1000px;
    filter: blur(1500px);
    z-index: -10;
    animation: grow-shrink 10s infinite ease-in-out;
}


@keyframes grow-shrink {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}
/* ===========================
   External Links Styles
   =========================== */

.agency-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.external-links-display {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.external-link-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--agency-light-bg);
    border: 1px solid var(--agency-border-color);
    border-radius: var(--agency-radius-small);
    text-decoration: none;
    color: var(--agency-text-color);
    font-size: 14px;
    font-weight: 500;
    transition: var(--agency-transition);
    position: relative;
}

.external-link-item:hover {
    background: var(--agency-primary-color);
    color: white;
    border-color: var(--agency-primary-color);
    transform: translateY(-2px);
    box-shadow: var(--agency-shadow);
}

.external-link-item .link-emoji {
    font-size: 18px;
    line-height: 1;
}

.external-link-item .link-text {
    line-height: 1;
}

.external-link-item .delete-external-link {
    margin-left: 4px;
    padding: 2px 6px;
    background: transparent;
    border: none;
    color: var(--agency-text-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: var(--agency-transition);
    border-radius: 4px;
}

.external-link-item .delete-external-link:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ef4444;
}

.external-link-item:hover .delete-external-link {
    color: rgba(255, 255, 255, 0.8);
}

/* Dark theme overrides */
.agency-theme-dark .external-link-item {
    background: #1f2937;
    border-color: #374151;
    color: var(--agency-text-color);
}

.agency-theme-dark .external-link-item:hover {
    background: var(--agency-primary-color);
    color: white;
}

/* Form help text */
.agency-form-help {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--agency-text-muted);
}

.agency-theme-dark .agency-form-help {
    color: #9ca3af;
}
/* === Version Tabs === */
.version-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 2rem 0;
    padding: 0;
    border-bottom: 2px solid var(--agency-border-color, #e0e0e0);
}

.version-tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1.25rem;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    color: var(--agency-text-color, #333);
    font-weight: 600;
    font-size: 1rem;
}

.version-tab:hover {
    background: var(--agency-bg-hover, #f5f5f5);
    color: var(--agency-primary-color, #000);
}

.version-tab.is-active {
    color: var(--agency-primary-color, #000);
    border-bottom-color: var(--agency-primary-color, #000);
}

.version-tab-label {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--agency-text-muted, #666);
}

.version-tab.is-active .version-tab-label {
    color: var(--agency-primary-color, #000);
}

.version-status {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-weight: 500;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity 0.2s;
}

.version-status:hover {
    opacity: 0.8;
}

.version-delete-btn {
    width: 22px;
    height: 22px;
    border: none;
    background: rgba(239, 68, 68, 0.85);
    color: white;
    border-radius: 50%;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-top: 0.25rem;
    flex-shrink: 0;
}

.version-delete-btn:hover {
    background: rgba(220, 38, 38, 1);
    transform: scale(1.1);
}

.version-status-draft { background: #ccc; color: #000; }
.version-status-in_review { background: #ffc107; color: #000; }
.version-status-approved { background: #4caf50; color: #fff; }
.version-status-archived { background: #9e9e9e; color: #fff; }

.version-panel {
    display: none;
    padding: 2rem 0;
}

.version-panel.is-active {
    display: block;
}

.version-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--agency-light-bg);
    border-radius: 8px;
    font-size: 0.95rem;
}

.version-notes {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--agency-light-bg);
    border-left: 4px solid var(--agency-primary-color);
    border-radius: 4px;
    font-size: 0.95rem;
}

.version-content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .version-content-grid {
        grid-template-columns: 1fr;
    }
}

.version-media {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.versioned-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.version-comments {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.version-comments h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--agency-text-color, #333);
}

.media-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-start;
}

/* ===================================
   VIDEO BLOCK STYLES
   =================================== */

/* Video Embeds Section */
.video-embeds {
    margin-bottom: 3rem;
}

.video-embeds h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--agency-text-color);
}

.video-embed-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.video-embed-item {
    position: relative;
    background: var(--agency-secondary-color);
    border-radius: var(--agency-radius-small);
    padding: 1.5rem;
    border: 1px solid var(--agency-border-color);
}

.video-embed-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--agency-border-color);
}

.video-embed-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: var(--agency-radius-small);
    background: #000;
    margin-bottom: 1rem;
}

.video-embed-wrapper iframe,
.video-embed-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: var(--agency-radius-small);
}

.video-embed-wrapper video {
    object-fit: contain;
}

.video-embed-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--agency-text-color);
}

.video-embed-item .delete-embed {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--agency-transition);
    z-index: 10;
}

.video-embed-item .delete-embed:hover {
    background: #dc3545;
    transform: scale(1.1);
}

.embed-error {
    padding: 2rem;
    text-align: center;
    color: #dc3545;
    background: #f8d7da;
    border-radius: var(--agency-radius-small);
    margin: 0;
}

/* Video Uploads Section */
.video-uploads {
    margin-bottom: 3rem;
}

.video-uploads h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--agency-text-color);
}

.video-upload-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.video-upload-item {
    background: var(--agency-secondary-color);
    border-radius: var(--agency-radius-small);
    padding: 1.5rem;
    border: 1px solid var(--agency-border-color);
}

.video-player-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: var(--agency-radius-small);
    background: #000;
    margin-bottom: 1rem;
}

.video-player-wrapper .video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: var(--agency-radius-small);
    object-fit: contain;
}

.video-file-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #fff;
}

.video-file-placeholder .file-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
}

.video-file-placeholder .file-name {
    font-size: 1rem;
    opacity: 0.8;
}

.video-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.video-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-start;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--agency-border-color);
}

.video-notes {
    padding-top: 0.5rem;
}

.asset-notes-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--agency-border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
    min-height: 80px;
}

.notes-save-status {
    font-size: 12px;
    display: inline-block;
    transition: var(--agency-transition);
}

.video-comments {
    padding-top: 1rem;
    border-top: 1px solid var(--agency-border-color);
}

.video-comments h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--agency-text-color);
}

.video-description {
    margin-bottom: 12px;
}

/* No content message */
.no-content {
    padding: 3rem;
    text-align: center;
    color: var(--agency-text-muted);
    font-size: 1.1rem;
}

/* Dark theme video styles */
.agency-theme-dark .video-embed-item,
.agency-theme-dark .video-upload-item {
    background: #111827;
    border-color: #374151;
}

.agency-theme-dark .asset-notes-input {
    background: #0b0f14;
    color: var(--agency-text-color);
    border-color: #374151;
}

.agency-theme-dark .video-actions {
    border-bottom-color: #374151;
}

.agency-theme-dark .video-comments {
    border-top-color: #374151;
}

.agency-theme-dark .video-embed-item .delete-embed {
    background: rgba(17, 24, 39, 0.9);
    color: #ffffff;
}

.agency-theme-dark .video-embed-item .delete-embed:hover {
    background: #dc3545;
}

/* ========================================
   COVER IMAGES (client & project)
   ======================================== */

.agency-client-cover,
.agency-project-cover {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60vh;
    min-height: 400px;
    background-image: var(--cover-url);
    background-size: cover;
    background-position: center top;
    z-index: 0;
    pointer-events: none;
}

/* Gradient fade to page background at the bottom */
.agency-client-cover::after,
.agency-project-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        var(--agency-light-bg) 80%
    );
}

/* Branding background colour tint on client cover */
.agency-client-cover::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--agency-light-bg, #f8f9fa);
    opacity: 0.20;
    z-index: 1;
}

/* Make wrapper a positioning context so cover is absolute within it */
.agency-wrapper:has(.agency-client-cover),
.agency-wrapper:has(.agency-project-cover) {
    position: relative;
    background: var(--agency-light-bg);
}

/* Ensure all siblings of cover sit above it */
.agency-wrapper:has(.agency-client-cover) > *:not(.agency-client-cover),
.agency-wrapper:has(.agency-project-cover) > *:not(.agency-project-cover) {
    position: relative;
    z-index: 1;
}

/* Let cover show through agency-main by removing its opaque background */
.agency-wrapper:has(.agency-client-cover) .agency-main,
.agency-wrapper:has(.agency-project-cover) .agency-main {
    background: transparent;
}

/* ========================================
   SEPARATOR BLOCK
   ======================================== */

.agency-separator-block {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 4px 0 !important;
    min-height: unset !important;
    height: auto !important;
    align-self: center;
    grid-column: 1 / -1 !important;
}

.separator-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 4px;
}

.separator-inner::before,
.separator-inner::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--agency-border-color);
}

.separator-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--agency-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
    min-width: 40px;
    text-align: center;
}

.separator-label[contenteditable="true"] {
    outline: none;
    cursor: text;
    padding: 2px 6px;
    border-radius: 4px;
}

.separator-label[contenteditable="true"]:focus {
    background: var(--agency-light-bg);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

/* ========================================
   BLOCK SUBTITLE
   ======================================== */

.agency-block-subtitle {
    font-size: 15px;
    font-weight: 400;
    color: var(--agency-text-muted);
    margin: -16px 0 20px 0;
    line-height: 1.5;
    text-align: center;
}

.agency-block-subtitle--editable {
    cursor: text;
    outline: none;
    border-bottom: 1px dashed transparent;
    transition: border-color 0.2s;
    padding: 4px 8px;
    border-radius: 4px;
}

.agency-block-subtitle--editable:hover,
.agency-block-subtitle--editable:focus {
    border-color: var(--agency-border-color);
    background: var(--agency-light-bg);
}

/* ========================================
   PROJECT LABELS — BADGES ON CARDS
   ======================================== */

.project-label-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.project-label-badge {
    display: inline-block;
    padding: 2px 10px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* When on a non-image card (no .has-project-bg) */
.agency-project-card:not(.has-project-bg) .project-label-badge {
    background: var(--agency-light-bg);
    border-color: var(--agency-border-color);
    color: var(--agency-text-muted);
}

/* ========================================
   LABEL FILTERS (client-view toolbar)
   ======================================== */

.agency-projects-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.agency-label-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.agency-label-filter {
    display: inline-block;
    padding: 6px 16px;
    border: 1px solid var(--agency-border-color);
    border-radius: 20px;
    background: var(--agency-secondary-color);
    color: var(--agency-text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--agency-transition);
}

.agency-label-filter:hover {
    background: var(--agency-primary-color);
    color: #ffffff;
    border-color: var(--agency-primary-color);
}

.agency-label-filter.active {
    background: var(--agency-primary-color);
    color: #ffffff;
    border-color: var(--agency-primary-color);
}

.agency-label-filter--archived {
    border-style: dashed;
}

.agency-label-filter--archived.active {
    background: #6b7280;
    border-color: #6b7280;
    border-style: solid;
}

.agency-archived-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--agency-text-muted);
    margin: 24px 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--agency-border-color);
}

/* ========================================
   LABEL TOGGLES (create/edit project modal)
   ======================================== */

.agency-labels-select {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0;
}

.agency-label-toggle {
    padding: 4px 14px;
    border: 1px solid var(--agency-border-color);
    border-radius: 20px;
    background: var(--agency-secondary-color);
    color: var(--agency-text-color);
    font-size: 13px;
    cursor: pointer;
    transition: var(--agency-transition);
}

.agency-label-toggle:hover {
    border-color: var(--agency-primary-color);
    color: var(--agency-primary-color);
}

.agency-label-toggle.selected {
    background: var(--agency-primary-color);
    border-color: var(--agency-primary-color);
    color: #ffffff;
}

/* ========================================
   LINK BLOCK VIEW
   ======================================== */

/* Two-column wrapper (left: link content, right: comments) */
.block-columns {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-top: 24px;
}

.block-column-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

@media (max-width: 900px) {
    .block-columns {
        grid-template-columns: 1fr;
    }
}

/* Manager URL panel */
.agency-link-manager-panel {
    background: var(--agency-light-bg);
    border: 1px solid var(--agency-border-color);
    border-radius: var(--agency-radius);
    padding: 20px 24px;
}

/* Client-facing link display card */
.agency-link-display {
    background: var(--agency-secondary-color);
    border: 1px solid var(--agency-border-color);
    border-radius: var(--agency-radius);
    padding: 48px 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.agency-link-display.has-block-bg {
    position: relative;
    overflow: hidden;
    color: #ffffff;
}

.agency-link-display.has-block-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 0;
}

.agency-link-display-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.agency-link-display .link-icon {
    font-size: 48px;
    line-height: 1;
}

.agency-link-display .link-label {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.agency-link-open-btn {
    font-size: 16px;
    padding: 14px 32px;
}

.agency-link-empty {
    padding: 32px;
    text-align: center;
    color: var(--agency-text-muted);
    background: var(--agency-light-bg);
    border-radius: var(--agency-radius);
    border: 1px dashed var(--agency-border-color);
}

/* ========================================
   STORYBOARD — VERSIONING UI
   ======================================== */

.storyboard-slide-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.storyboard-slide-num {
    font-size: 13px;
    font-weight: 700;
    color: var(--agency-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

/* Override .version-badge for inline display in storyboard slide header */
.storyboard-slide-header .version-badge {
    position: static;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--agency-primary-color);
    color: #ffffff;
}

/* Insert-row between slides */
.storyboard-insert-row {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
}

.storyboard-insert-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px dashed var(--agency-border-color);
    background: var(--agency-secondary-color);
    color: var(--agency-text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--agency-transition);
    opacity: 0;
}

/* Show insert button on hover of surrounding area */
.storyboard-insert-row:hover .storyboard-insert-btn,
.storyboard-item:hover + .storyboard-insert-row .storyboard-insert-btn {
    opacity: 1;
}

.storyboard-insert-btn:hover {
    background: var(--agency-primary-color);
    border-color: var(--agency-primary-color);
    color: #ffffff;
    opacity: 1;
}

/* Version history collapsible */
.version-history {
    margin-top: 8px;
}

.version-history-toggle {
    background: none;
    border: none;
    color: var(--agency-text-muted);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 0;
    text-decoration: underline dotted;
    transition: color 0.2s;
}

.version-history-toggle:hover {
    color: var(--agency-primary-color);
}

.version-history-list {
    margin-top: 8px;
    padding: 12px;
    background: var(--agency-light-bg);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.version-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--agency-border-color);
}

.version-item:last-child {
    border-bottom: none;
}

.version-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--agency-primary-color);
    min-width: 28px;
}

.version-thumb {
    width: 50px;
    height: 38px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--agency-border-color);
}

.version-filename {
    font-size: 12px;
    color: var(--agency-text-muted);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Client suggestion zone */
.slide-suggestion-zone {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--agency-border-color);
}

.suggest-slide-form {
    margin-top: 10px;
    padding: 12px;
    background: var(--agency-light-bg);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.suggest-text-input {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--agency-border-color);
    padding: 8px 10px;
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
}

/* ========================================
   DARK THEME — new components
   ======================================== */

.agency-theme-dark .agency-label-filter,
.agency-theme-dark .agency-label-toggle {
    background: #111827;
    border-color: #374151;
    color: var(--agency-text-color);
}

.agency-theme-dark .agency-label-filter.active,
.agency-theme-dark .agency-label-toggle.selected {
    background: var(--agency-primary-color);
    border-color: var(--agency-primary-color);
    color: #ffffff;
}

.agency-theme-dark .agency-separator-block .separator-inner::before,
.agency-theme-dark .agency-separator-block .separator-inner::after {
    background: #374151;
}

.agency-theme-dark .agency-link-manager-panel {
    background: #111827;
    border-color: #374151;
}

.agency-theme-dark .agency-link-display {
    background: #111827;
    border-color: #374151;
}

.agency-theme-dark .version-history-list {
    background: #111827;
}

.agency-theme-dark .suggest-slide-form {
    background: #111827;
}

.agency-theme-dark .suggest-text-input {
    background: #0b0f14;
    border-color: #374151;
    color: var(--agency-text-color);
}

.agency-theme-dark .storyboard-insert-btn {
    background: #111827;
    border-color: #374151;
}

/* ========================================
   PROJECT COVER ACTIONS
   ======================================== */

.project-cover-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0 8px 0;
}

/* Danger button variant */
.agency-btn-danger {
    background: transparent;
    color: #ef4444;
    border: 1px solid #ef4444;
    border-radius: var(--agency-radius);
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: var(--agency-transition);
    font-family: inherit;
}
.agency-btn-danger:hover {
    background: #ef4444;
    color: #fff;
}

/* ========================================
   BLOCK DESCRIPTIONS (script, versioned)
   ======================================== */

.script-description,
.block-description {
    font-size: 14px;
    line-height: 1.6;
    color: var(--agency-text-muted);
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--agency-light-bg);
    border-radius: var(--agency-radius);
    border-left: 3px solid var(--agency-border-color);
    min-height: 36px;
}

.script-description[contenteditable="true"],
.block-description[contenteditable="true"] {
    cursor: text;
    outline: none;
    border-left-color: var(--agency-primary-color);
    transition: var(--agency-transition);
}
.script-description[contenteditable="true"]:focus,
.block-description[contenteditable="true"]:focus {
    background: var(--agency-bg-color, #fff);
    box-shadow: 0 0 0 2px rgba(var(--agency-primary-rgb, 0,0,0), 0.1);
}
.script-description:empty::before,
.block-description:empty::before {
    content: attr(data-placeholder);
    color: var(--agency-text-muted);
    opacity: 0.5;
    pointer-events: none;
}

/* Dark theme */
.agency-theme-dark .script-description,
.agency-theme-dark .block-description {
    background: #0b0f14;
    border-left-color: #374151;
}
.agency-theme-dark .project-cover-actions .agency-btn-secondary {
    border-color: #374151;
    color: var(--agency-text-color);
}

/* ========================================
   PROJECT ASSETS PICKER
   ======================================== */

.agency-modal-content--wide {
    max-width: 760px;
}

.project-assets-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.project-assets-picker-item {
    cursor: pointer;
    border-radius: var(--agency-radius);
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.15s ease, transform 0.15s ease;
    aspect-ratio: 1;
    background: var(--agency-light-bg);
}

.project-assets-picker-item:hover {
    border-color: var(--agency-primary-color);
    transform: scale(1.03);
}

.project-assets-picker-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project-assets-picker-loading {
    color: var(--agency-text-muted);
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

/* ========================================
   BLOCK PRESETS
   ======================================== */

.agency-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--agency-text-color);
    cursor: pointer;
    margin-bottom: 8px;
}

.agency-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--agency-primary-color, #0073aa);
}

.presets-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 420px;
    overflow-y: auto;
}

.presets-list-loading {
    color: var(--agency-text-muted);
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

.preset-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--agency-border-color);
    border-radius: 8px;
    background: var(--agency-bg-secondary, #f8f9fa);
}

.preset-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.preset-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--agency-text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preset-card-date {
    font-size: 12px;
    color: var(--agency-text-muted);
}

.preset-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}



.google-doc-section {
    margin-top: 24px;
}

.google-doc-iframe {
    width: 100%;
    height: 80vh;
    min-height: 500px;
    border: 1px solid var(--agency-border-color);
    border-radius: var(--agency-radius);
}

.google-doc-cta {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

/* ========================================
   FILE DEPOSIT BLOCK
   ======================================== */

.file-deposit-settings {
    background: var(--agency-light-bg);
    border: 1px solid var(--agency-border-color);
    border-radius: var(--agency-radius);
    padding: 20px 24px;
    margin: 24px 0;
}

.file-deposit-settings h3 {
    margin: 0 0 16px;
    font-size: 15px;
    font-weight: 600;
}

.file-deposit-settings-form {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.file-deposit-settings-form .agency-form-group {
    flex: 1;
    min-width: 180px;
    margin: 0;
}

.file-deposit-upload {
    margin: 24px 0;
}

.file-deposit-upload h3 {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 600;
}

.file-deposit-constraints {
    font-size: 13px;
    color: var(--agency-text-muted);
    margin: 0 0 12px;
}

.file-deposit-zone {
    border: 2px dashed var(--agency-border-color);
    border-radius: var(--agency-radius);
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.file-deposit-zone:hover,
.file-deposit-zone.is-dragover {
    border-color: var(--agency-primary-color);
    background: var(--agency-light-bg);
}

.file-deposit-zone-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

.file-deposit-zone p {
    margin: 0;
    font-size: 14px;
    color: var(--agency-text-muted);
}

.file-deposit-input-hidden {
    display: none;
}

.file-deposit-progress-bar {
    background: var(--agency-border-color);
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
    margin: 12px 0 4px;
}

.file-deposit-progress-fill {
    background: var(--agency-primary-color);
    height: 100%;
    width: 0;
    transition: width 0.2s ease;
}

.file-deposit-progress-label {
    font-size: 12px;
    color: var(--agency-text-muted);
}

.file-deposit-error {
    color: var(--agency-danger-color, #dc2626);
    font-size: 13px;
    margin-top: 8px;
}

.file-deposit-list {
    margin-top: 32px;
}

.file-deposit-list h3 {
    margin: 0 0 16px;
    font-size: 15px;
    font-weight: 600;
}

.file-deposit-empty {
    color: var(--agency-text-muted);
    font-size: 14px;
}

.file-deposit-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-deposit-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--agency-secondary-color);
    border: 1px solid var(--agency-border-color);
    border-radius: var(--agency-radius);
    padding: 12px 16px;
}

.file-deposit-item-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.file-deposit-item-info {
    flex: 1;
    min-width: 0;
}

.file-deposit-item-name {
    display: block;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-deposit-item-meta {
    display: block;
    font-size: 12px;
    color: var(--agency-text-muted);
    margin-top: 2px;
}

.file-deposit-item-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

/* === File Deposit — Dark Mode === */
.agency-theme-dark .file-deposit-settings,
.agency-theme-dark .file-deposit-upload,
.agency-theme-dark .file-deposit-list {
    color: var(--agency-text-color);
}

.agency-theme-dark .file-deposit-zone {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.04);
}

.agency-theme-dark .file-deposit-zone:hover,
.agency-theme-dark .file-deposit-zone.is-dragover {
    border-color: var(--agency-primary-color);
    background: rgba(255, 255, 255, 0.08);
}

.agency-theme-dark .file-deposit-item {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.agency-theme-dark .file-deposit-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.agency-theme-dark .file-deposit-item-name {
    color: var(--agency-text-color);
}

.agency-theme-dark .file-deposit-item-meta {
    color: var(--agency-text-muted);
}

.agency-theme-dark .file-deposit-item-icon {
    color: var(--agency-text-muted);
}

.agency-theme-dark .file-deposit-settings h3,
.agency-theme-dark .file-deposit-upload h3,
.agency-theme-dark .file-deposit-list h3 {
    color: var(--agency-text-color);
}

.agency-theme-dark .file-deposit-constraints {
    color: var(--agency-text-muted);
}

.agency-theme-dark .file-deposit-progress-bar {
    background: rgba(255, 255, 255, 0.1);
}

.agency-theme-dark .file-deposit-empty {
    color: var(--agency-text-muted);
}

/* ========================================
   v0.9.4 — PDF PREVIEW (Versioned Media)
   ======================================== */

.versioned-pdf-preview {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pdf-preview-frame {
    width: 100%;
    height: 600px;
    border: 1px solid var(--agency-border-color, #e0e0e0);
    border-radius: var(--agency-radius-small, 12px);
    background: #fff;
}

.pdf-download-fallback {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--agency-secondary-color, #fff);
    border: 1px solid var(--agency-border-color, #e0e0e0);
    border-radius: var(--agency-radius-small, 12px);
    font-size: 14px;
}

.pdf-download-fallback .file-icon {
    font-size: 20px;
}

.pdf-download-fallback .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   v0.9.4 — UPLOAD PROGRESS OVERLAY
   ======================================== */

.agency-upload-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: var(--agency-header-height, 70px);
}

.agency-upload-modal {
    background: var(--agency-secondary-color, #fff);
    border-radius: var(--agency-radius, 25px);
    padding: 40px 48px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.agency-upload-modal h3 {
    margin: 0 0 16px;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--agency-text-color, #333);
}

.upload-progress-info {
    font-size: 14px;
    color: var(--agency-text-muted, #6b7280);
    margin-bottom: 16px;
}

.upload-progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--agency-border-color, #e0e0e0);
    border-radius: 4px;
    overflow: hidden;
}

.upload-progress-bar-fill {
    height: 100%;
    background: var(--agency-primary-color, #000);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* ========================================
   v0.9.4 — STORYBOARD SLIDE DELETE BUTTON
   ======================================== */

.storyboard-item {
    position: relative;
}

.storyboard-slide-delete {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

.storyboard-item:hover .storyboard-slide-delete {
    opacity: 1;
}

.storyboard-slide-delete:hover {
    background: var(--agency-danger-color, #dc2626);
}

/* ========================================
   v0.9.4 — HAMBURGER MENU (mobile)
   ======================================== */

.agency-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
}

.agency-hamburger:hover {
    background: rgba(0, 0, 0, 0.06);
}

.agency-hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--agency-text-color, #333);
    border-radius: 1px;
    transition: transform 0.3s, opacity 0.3s;
}

.agency-hamburger.is-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.agency-hamburger.is-active span:nth-child(2) {
    opacity: 0;
}

.agency-hamburger.is-active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ========================================
   v0.9.4 — MOBILE RESPONSIVE OVERRIDES
   ======================================== */

@media (max-width: 768px) {
    /* Show hamburger on mobile */
    .agency-hamburger {
        display: flex;
    }

    /* Hide decorative blur elements on mobile */
    .blur-1,
    .blur-2 {
        display: none !important;
    }

    /* Ensure dropdown isn't clipped and header is fixed */
    .agency-header-fixed {
        overflow: visible;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 99990;
    }

    /* Fix project card overflow on mobile */
    .block-title-small,
    .agency-project-card .block-title,
    .agency-project-card h3 {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }

    .agency-project-card {
        max-width: 100%;
        overflow: hidden;
    }

    /* Header layout */
    .agency-header-container {
        flex-wrap: nowrap;
        position: relative;
        padding: 0 12px;
    }

    .agency-header-left {
        flex: 1;
        min-width: 0;
    }

    .agency-header-client-name {
        font-size: 0.85em;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Hide right section by default on mobile */
    .agency-header-right {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--agency-header-bg, rgba(255,255,255,0.95));
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        flex-direction: column;
        padding: 16px 20px;
        gap: 12px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
        border-top: 1px solid var(--agency-border-color, #e0e0e0);
        z-index: 99991;
        overflow-y: auto;
        max-height: 80vh;
    }

    .agency-header-right.is-open {
        display: flex;
    }

    /* Breadcrumb vertical on mobile menu */
    .agency-header-breadcrumb {
        flex-direction: column;
        gap: 8px;
        font-size: 0.9em;
    }

    .breadcrumb-separator {
        display: none;
    }

    .breadcrumb-item {
        padding: 6px 0;
    }

    /* User section in mobile menu */
    .agency-header-user {
        padding-top: 8px;
        border-top: 1px solid var(--agency-border-color, #e0e0e0);
    }

    /* Reduced paddings on mobile */
    .agency-main {
        padding-top: 16px;
    }

    .agency-container {
        padding: 0 12px;
    }

    /* Prevent horizontal overflow on mobile */
    .agency-wrapper {
        overflow-x: hidden;
    }

    .agency-wrapper,
    .agency-main,
    .agency-container,
    .agency-block-view {
        max-width: 100%;
    }

    .agency-block {
        min-width: 0;
    }

    .block-header-full {
        padding: 16px;
    }

    /* Storyboard items stacking */
    .storyboard-item {
        flex-direction: column;
    }

    .storyboard-media,
    .storyboard-comments {
        width: 100%;
    }

    /* Upload overlay mobile */
    .agency-upload-modal {
        padding: 28px 24px;
        max-width: 90%;
    }

    /* PDF preview smaller on mobile */
    .pdf-preview-frame {
        height: 350px;
    }

    /* Slide delete always visible on mobile (no hover) */
    .storyboard-slide-delete {
        opacity: 1;
    }
}

/* Dark theme adjustments for new elements */
.agency-theme-dark .agency-hamburger span {
    background: var(--agency-text-color, #e4e4e7);
}

.agency-theme-dark .agency-hamburger:hover {
    background: rgba(255, 255, 255, 0.08);
}

.agency-theme-dark .agency-upload-modal {
    background: var(--agency-card-bg, #16191f);
}

.agency-theme-dark .storyboard-slide-delete {
    background: rgba(255, 255, 255, 0.25);
}

.agency-theme-dark .pdf-preview-frame {
    background: #1a1a2e;
    border-color: var(--agency-border-color);
}

/* ========================================
   v0.9.9 UX FIXES
   ======================================== */

/* UX 11 — Preset-card dark mode */
.agency-theme-dark .preset-card {
    background: #111827;
    border-color: #1f2937;
}

/* UX 12 — Separator trash icon: white in dark mode, muted in light */
.agency-separator-block .delete-block {
    color: var(--agency-text-muted);
}
.agency-theme-dark .agency-separator-block .delete-block {
    color: #ffffff;
}

/* UX 14 — Clickable block cards in client/project view */
.agency-block.clickable-card {
    cursor: pointer;
}
.agency-block.clickable-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--agency-shadow-hover);
}

/* ========================================
   v0.9.11 — MOBILE HEADER ENHANCEMENTS
   ======================================== */

/* Flèche retour — cachée sur desktop */
.agency-back-arrow {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: currentColor;
    text-decoration: none;
    flex-shrink: 0;
    transition: background 0.2s;
}
.agency-back-arrow:hover {
    background: rgba(0, 0, 0, 0.08);
}
.agency-theme-dark .agency-back-arrow:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Liste de projets dans le menu mobile — cachée par défaut */
.agency-mobile-projects {
    display: none;
    width: 100%;
}
.agency-mobile-projects-label {
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--agency-text-muted);
    margin: 0 0 6px;
    padding: 0 12px;
}
.agency-mobile-projects ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.agency-mobile-projects ul li a {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--agency-radius-small);
    color: var(--agency-text-color);
    text-decoration: none;
    font-size: 0.95em;
    transition: background 0.2s;
    min-height: 44px;
}
.agency-mobile-projects ul li a:hover {
    background: rgba(0, 0, 0, 0.06);
}
.agency-theme-dark .agency-mobile-projects ul li a:hover {
    background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 768px) {
    /* Activer la flèche retour */
    .agency-back-arrow {
        display: flex;
    }

    /* Afficher la liste de projets dans le panneau ouvert */
    .agency-header-right.is-open .agency-mobile-projects {
        display: block;
        padding: 12px 0;
        border-top: 1px solid var(--agency-border-color);
    }

    /* Ajustements en-tête : éviter le débordement du titre */
    .agency-header-client-name {
        max-width: calc(100vw - 140px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .agency-header-logo {
        height: 30px;
    }

    /* S'assurer que la flèche + logo sont alignés */
    .agency-header-left {
        display: flex;
        align-items: center;
        gap: 6px;
        overflow: hidden;
    }

    /* Iframes vidéo responsive */
    .video-embed-container iframe,
    .video-embed-container video {
        width: 100%;
        aspect-ratio: 16 / 9;
        height: auto;
    }
}

/* === Google Slides Embed (v0.9.11) === */
.agency-google-slides-container {
    margin-top: 24px;
}
.agency-google-slides-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.agency-google-slides-cta svg {
    vertical-align: middle;
    margin-right: 6px;
}
.agency-google-slides-embed {
    position: relative;
    width: 100%;
    /* Aspect 16/9 + extra space for the Google Slides navigation bar at the bottom */
    padding-bottom: calc(56.25% + 40px);
    height: 0;
    border-radius: var(--agency-radius);
    overflow: visible;
    box-shadow: var(--agency-shadow-strong);
}
.agency-google-slides-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: var(--agency-radius);
}
.agency-google-slides-setup {
    padding: 20px;
    border: 2px dashed var(--agency-border-color);
    border-radius: var(--agency-radius);
    margin-top: 24px;
}
.agency-google-slides-hint {
    color: var(--agency-text-muted);
    font-size: 0.9em;
    margin: 0 0 12px;
}
.agency-google-slides-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}
.agency-google-slides-input-row .agency-input {
    flex: 1;
    min-width: 0;
}

/* === Storyboard Upload Position Modal (v0.9.11) === */
.agency-position-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: var(--agency-header-height, 70px);
}
.agency-position-modal .agency-modal-box {
    background: var(--agency-secondary-color, #fff);
    border-radius: var(--agency-radius);
    padding: 32px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}
.agency-position-modal .agency-modal-title {
    font-weight: 700;
    font-size: 1.1em;
    margin: 0 0 8px;
}
.agency-position-modal .agency-modal-sub {
    color: var(--agency-text-muted);
    font-size: 0.9em;
    margin: 0 0 24px;
}
.agency-position-modal .agency-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}



.agency-resize-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    transform: translate(-50%, -100%);
    margin-top: -10px;
}



/* Hide block content previews in project view cards */
.agency-project-view .agency-block .block-content,
.agency-project-view .agency-block .block-snippet {
    display: none !important;
}

/* Fix overlap with WP Admin Bar */
body.admin-bar .agency-header-fixed {
    top: 32px;
}
@media screen and (max-width: 782px) {
    body.admin-bar .agency-header-fixed {
        top: 46px;
    }
}

/* When the wrapper has a cover, the header becomes position: relative and flows relative to html naturally, we prevent double-pushing. */
body.admin-bar .agency-wrapper:has(.agency-client-cover) .agency-header-fixed,
body.admin-bar .agency-wrapper:has(.agency-project-cover) .agency-header-fixed {
    top: 0;
}
