/* ==========================================================================
   Euzhan - Publisher Module (Editor, Modals, Drafts & Skeletons)
   ========================================================================= */

/* --- SOCKET PREVIEW & GRID LAYOUT (BETA 3) --- */

/* CONTENEUR PRINCIPAL (La Feuille) */
.editor-zone {
    background: var(--resca-white);
    padding: 50px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    margin-top: 40px;
    border: 1px solid var(--resca-border-light);
}

textarea#final-title {
    font-size: 16px;
    /* Same as content */
    font-weight: 600;
    /* Semi-bold */
    color: var(--resca-dark);
    border: 1px solid transparent;
    /* Prepare for hover/focus */
    background: transparent;
    width: 100%;
    padding: 0px;
    margin-bottom: 0px;
    outline: none;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    resize: none;
    overflow: hidden;
    display: block;
    border-radius: var(--radius-sm);
}

textarea#final-title::placeholder {
    color: var(--resca-border);
}

/* LE CORPS DU TEXTE (Corps de l'article) */
textarea#final-content {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0px;
    font-size: 16px;
    line-height: 1.6;
    color: var(--resca-text-main);
    resize: none;
    min-height: 100px;
    outline: none;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    overflow: hidden;
    /* Pour auto-resize */
    border-radius: 4px;
    box-shadow: none;
    /* No shadow */
}

/* Focus States (Simplified like Title) */
textarea#final-content:focus {
    border: none;
    background-color: transparent;
    box-shadow: none;
    outline: none;
}

textarea#final-title:focus {
    background-color: transparent;
    border-color: transparent;
    box-shadow: none;
}

textarea#final-content:hover {
    border-color: #f0f0f0;
}

.editor-main-col>label {
    display: none;
}

/* Layout Grid Desktop */
@media (min-width: 1400px) {
    #editor-zone {
        display: grid;
        grid-template-columns: 1fr 340px;
        gap: 50px;
        align-items: start;
    }

    .editor-main-col {
        min-width: 0;
    }

    .editor-preview-col {
        /* Sticky disabled */
    }
}

/* Disclaimer Left Align */
#ai-disclaimer {
    text-align: left;
    margin-top: 5px;
    font-style: italic;
    font-size: 0.9em;
    color: var(--resca-text-muted);
}

/* Article Editor Top Layout */
.editor-top-layout {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.editor-top-layout .upload-zone-thumb {
    width: 100px;
    height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--resca-white) !important;
    border: 2px dashed var(--resca-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.editor-top-layout .upload-prev {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    border-radius: var(--radius-sm);
}

.editor-top-layout .upload-hint {
    font-size: 9px;
    line-height: 1.2;
    font-weight: 800;
    color: var(--resca-primary);
}

.editor-top-layout .editor-header-input,
.editor-top-layout .editor-chapo-input {
    width: 100%;
    border: 1px solid var(--resca-border);
    border-radius: var(--radius-md);
    background: var(--resca-white) !important;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
    color: var(--resca-dark);
}

.editor-top-layout .editor-header-input {
    font-size: 16px;
    padding: 10px 12px;
    margin-bottom: 0;
    font-weight: 700;
}

.editor-top-layout .editor-chapo-input {
    font-size: 13px;
    padding: 10px 12px;
    margin-bottom: 0;
    flex: 1;
    resize: none;
}

.editor-header-input::placeholder {
    color: var(--resca-border);
}

.upload-zone {
    border: 2px dashed var(--resca-border);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    cursor: pointer;
    background: var(--resca-white, #fff);
    transition: background var(--transition-fast);
}

.upload-zone:hover {
    background: #eef7f6;
}

.upload-prev {
    max-width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    display: none;
    margin: 0 auto;
}

.upload-hint {
    color: var(--resca-dark);
    font-weight: 600;
    font-size: 13px;
}

/* === SKELETON SCREEN (Global) === */
.skeleton-wrapper {
    padding: 40px 60px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.skeleton-header {
    width: 40%;
    height: 28px;
    background: var(--resca-skeleton-bg);
    border-radius: 6px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.skeleton-line {
    height: 16px;
    background: var(--resca-skeleton-bg);
    border-radius: 4px;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
}

.skeleton-line.short {
    width: 60%;
}

.skeleton-line.medium {
    width: 80%;
}

.skeleton-line.long {
    width: 100%;
}

.skeleton-block {
    height: 120px;
    background: var(--resca-skeleton-bg);
    border-radius: 8px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

/* Shimmer Animation */
.skeleton-header::after,
.skeleton-line::after,
.skeleton-block::after,
.skeleton-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            var(--resca-skeleton-shimmer),
            transparent);
    animation: shimmer 1.2s infinite ease-in-out;
}

@keyframes shimmer {
    0% {
        transform: translateX(0%);
    }

    100% {
        transform: translateX(200%);
    }
}

/* Grid skeleton for dashboard */
.skeleton-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
}

.skeleton-card {
    height: 100px;
    background: var(--resca-skeleton-bg);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

@media (max-width: 900px) {
    .skeleton-wrapper {
        padding: 20px;
    }

    .skeleton-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   TAG PILLS SYSTEM
   ======================================== */
.tag-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    background: transparent;
    padding: 0;
    min-height: auto;
    margin-top: 8px;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    background: var(--resca-accent);
    color: var(--resca-dark);
    padding: 6px 8px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    gap: 6px;
    white-space: nowrap;
}

.tag-pill-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: background var(--transition-fast);
}

.tag-pill-close:hover {
    background: rgba(0, 0, 0, 0.3);
}

.tag-input {
    flex: 1;
    min-width: 120px;
    border: none !important;
    background: var(--resca-grey) !important;
    padding: 8px 12px !important;
    border-radius: var(--radius-md);
    font-size: 14px;
    outline: none;
    box-shadow: none !important;
}

.tag-input:focus {
    outline: none;
    box-shadow: none !important;
}

/* ========================================
   SKELETON LOADER
   ======================================== */
.skeleton-item {
    pointer-events: none;
}

.skeleton-title {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
    background: var(--resca-skeleton-bg);
    position: relative;
    overflow: hidden;
}

.skeleton-title.short {
    width: 60%;
}

.skeleton-source {
    height: 20px;
    width: 50px;
    border-radius: var(--radius-md);
    background: var(--resca-skeleton-bg);
    margin-top: 8px;
    position: relative;
    overflow: hidden;
}

#sugg-feed-skeleton {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: 100%;
}

.skeleton-preview {
    height: 12px;
    margin-bottom: 6px;
    border-radius: 4px;
    background: var(--resca-skeleton-bg);
    position: relative;
    overflow: hidden;
    width: 100%;
}

.skeleton-preview.short {
    width: 70%;
}

.skeleton-title::after,
.skeleton-source::after,
.skeleton-preview::after {
    content: "";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, transparent, var(--resca-skeleton-shimmer), transparent);
    transform: translateX(-100%);
    animation: skeleton-shimmer 1.5s infinite;
}

@keyframes skeleton-shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* === DYNAMIC GENERATION FEEDBACK (Gemini Button) === */

@property --trail-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@property --trail-color-start {
    syntax: '<color>';
    initial-value: transparent;
    inherits: false;
}

@property --trail-spread {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@keyframes spin-loop {
    from {
        --trail-angle: 0deg;
        --trail-color-start: transparent;
        --trail-spread: 30deg;
    }

    to {
        --trail-angle: 360deg;
        --trail-color-start: transparent;
        --trail-spread: 30deg;
    }
}

@keyframes fill-solid-ease-in {
    from {
        --trail-angle: 360deg;
        --trail-color-start: transparent;
        --trail-spread: 30deg;
    }

    to {
        --trail-angle: 360deg;
        --trail-color-start: #A6F2E8;
        --trail-spread: 360deg;
    }
}

.resca-btn.btn-generating,
.resca-btn.btn-generated-success {
    position: relative;
    overflow: hidden;
    border-color: transparent !important;
    background: var(--resca-dark) !important;
    color: var(--resca-white) !important;
    transition: background 0.5s ease, color 0.5s ease;
}

.resca-btn.btn-generated-success.fade-out {
    background: var(--resca-white) !important;
    color: var(--resca-dark) !important;
}

.resca-btn.btn-generating::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 4px;
    background: conic-gradient(from var(--trail-angle), var(--trail-color-start) 0deg, #A6F2E8 var(--trail-spread), transparent var(--trail-spread));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    z-index: 10;
    opacity: 1;
    animation: spin-loop 1s linear infinite;
    pointer-events: none;
}

.resca-btn.btn-generated-success::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 4px;
    background: conic-gradient(from var(--trail-angle), var(--trail-color-start) 0deg, #A6F2E8 var(--trail-spread), transparent var(--trail-spread));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    z-index: 10;
    opacity: 1;
    animation: fill-solid-ease-in 0.8s ease-in forwards;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.resca-btn.btn-generated-success.fade-out::before {
    opacity: 0;
}

/* Skeleton Output */
.skeleton-text-line {
    background: var(--resca-skeleton-bg);
    height: 16px;
    margin-bottom: 8px;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    display: block;
}

.skeleton-text-line.full {
    width: 100%;
}

.skeleton-text-line.three-quarter {
    width: 75%;
}

.skeleton-text-line.half {
    width: 50%;
}

.skeleton-text-line.one-third {
    width: 33%;
}

.skeleton-text-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--resca-skeleton-shimmer), transparent);
    animation: shimmer 1.2s infinite ease-in-out;
}

/* ========================================
   SPLIT BUTTON & DROPDOWN SYSTEM
   ======================================== */
.resca-split-btn-group {
    display: flex;
    width: 100%;
    margin-top: 10px;
    position: relative;
    box-shadow: var(--shadow-btn);
    border-radius: var(--radius-pill);
    overflow: visible;
}

.resca-btn-split-main {
    flex: 0 0 88%;
    border-radius: var(--radius-pill) 0 0 var(--radius-pill) !important;
    border-right: 1px solid rgba(0, 0, 0, 0.1) !important;
    margin: 0 !important;
}

.resca-btn-split-arrow {
    flex: 0 0 12%;
    border-radius: 0 var(--radius-pill) var(--radius-pill) 0 !important;
    padding: 12px 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
}

.resca-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--resca-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    min-width: 220px;
    display: none;
    overflow: hidden;
    border: 1px solid var(--resca-border-light);
}

.resca-dropdown-menu.active {
    display: block;
    animation: fadeInScale 0.2s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.resca-dropdown-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: var(--resca-dark);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: background var(--transition-fast);
    cursor: pointer;
}

.resca-dropdown-item:hover {
    background: var(--resca-grey);
}

.resca-dropdown-item i {
    margin-right: 10px;
    font-size: 16px;
}

/* ========================================
   MODAL SYSTEM
   ======================================== */
.resca-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.resca-modal.active {
    display: flex;
}

.resca-modal-content {
    background: var(--resca-white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 450px;
    padding: 40px;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: modalSlideUp 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.resca-modal-close {
    position: absolute;
    top: 25px;
    right: 25px;
    font-size: 28px;
    color: var(--resca-text-muted);
    cursor: pointer;
    line-height: 1;
}

.resca-modal h3 {
    margin-top: 0;
    margin-bottom: 30px;
    color: var(--resca-dark);
    font-weight: 800;
    font-size: 24px;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.resca-modal-body {
    margin-bottom: 30px;
}

.resca-timezone-info {
    font-size: 12px;
    color: var(--resca-text-muted);
    margin-top: 8px;
    font-weight: 500;
}

#schedule-date, #schedule-time {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--resca-border);
    border-radius: var(--radius-md);
    background: var(--resca-white);
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 14px;
    color: var(--resca-dark);
    margin-top: 8px;
    font-weight: 500;
}

#schedule-datetime {
    margin-top: 10px;
    font-weight: 600;
}

/* ========================================
   DROPDOWN DIVIDER
   ======================================== */
.resca-dropdown-divider {
    height: 1px;
    background: var(--resca-border-light);
    margin: 8px 0;
}

/* ========================================
   DRAFT ITEMS
   ======================================== */
.draft-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px;
    background: var(--resca-grey);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
    gap: 15px;
}

.draft-item:hover {
    background: var(--resca-accent);
}

.draft-item-info {
    flex: 1;
    min-width: 0;
}

.draft-item-title {
    font-weight: 700;
    color: var(--resca-dark);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.draft-item-excerpt {
    font-size: 13px;
    color: var(--resca-text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

.draft-item-meta {
    font-size: 11px;
    color: var(--resca-text-muted);
    display: flex;
    gap: 15px;
}

.draft-item-delete {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 0, 0, 0.1);
    color: #c62828;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all var(--transition-fast);
}

.draft-item-delete:hover {
    background: #c62828;
    color: white;
}

.drafts-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--resca-text-muted);
    font-style: italic;
}

/* ========================================
   VIDEO MENU UI SKELETON
   ======================================== */

.video-section {
    margin-bottom: 30px;
}

.video-scroll-container {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding-bottom: 20px;
    -webkit-overflow-scrolling: touch;
}

.skeleton-video-card-vertical {
    width: 140px;
    background: var(--resca-white);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--resca-border-light);
    flex-shrink: 0;
}

.skeleton-video-card-horizontal {
    width: 250px;
    background: var(--resca-white);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--resca-border-light);
    flex-shrink: 0;
}

.skeleton-video-thumb-vertical {
    aspect-ratio: 9/16;
    background: var(--resca-skeleton-bg);
    position: relative;
    overflow: hidden;
}

.skeleton-video-thumb-horizontal {
    aspect-ratio: 16/9;
    background: var(--resca-skeleton-bg);
    position: relative;
    overflow: hidden;
}

.skeleton-video-title {
    height: 12px;
    background: var(--resca-skeleton-bg);
    margin: 15px 15px 8px 15px;
    border-radius: 4px;
}

.skeleton-video-meta {
    height: 12px;
    width: 50%;
    background: var(--resca-skeleton-bg);
    margin: 0 15px 15px 15px;
    border-radius: 4px;
}
