/* =========================================
   VISTA: BANDEJA DE SALIDA (Estilo Framer Motion + Botonera)
   ========================================= */

.drafts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* Tarjeta Principal */
.react-card {
    padding: 12px;
    display: flex;
    flex-direction: column;
    background-color: #09090b; 
    border-radius: 16px; 
    border: 1px solid #18181b; 
    transition: all 0.3s ease;
}

.react-card:hover {
    border-color: #27272a;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

/* Contenedor de Imagen con Overlays */
.react-card-image {
    width: 100%;
    height: 180px; 
    border-radius: 8px; 
    overflow: hidden;
    margin-bottom: 16px;
    background: #111;
    position: relative;
}

.react-card-image img,
.react-card-image video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Overlay: Botón Seleccionar */
.badge-select {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(9, 9, 11, 0.7);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e4e4e7;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}
.badge-select:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

/* Overlay: Etiqueta de Cliente */
.badge-client {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    z-index: 10;
}

/* Textos */
.react-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}

.react-card-date {
    color: #71717a;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.react-card-desc {
    color: #a1a1aa; 
    font-size: 0.85rem; 
    font-weight: 400;
    margin: 0 0 16px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

/* =========================================
   CORRECCIÓN: TÍTULO LARGO EN LA BANDEJA
   ========================================= */
.react-card-title {
    color: #ffffff;
    font-weight: 600;
    font-size: 1.1rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px; 
}

/* =========================================
   NUEVA BOTONERA (Bandeja)
   ========================================= */
.react-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px solid #18181b;
    padding-top: 16px;
    margin-top: auto; 
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #27272a; 
    border-radius: 8px;
    color: #a1a1aa;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn svg { width: 14px; height: 14px; }
.action-btn:hover { background: #18181b; color: #ffffff; border-color: #3f3f46; }

.action-btn.primary { background: #fafafa; color: #09090b; border-color: #fafafa; font-weight: 600; }
.action-btn.primary:hover { background: #e4e4e7; }

.action-btn.danger { padding: 6px 8px; }
.action-btn.danger:hover { background: rgba(239, 68, 68, 0.1); color: #ef4444; border-color: rgba(239, 68, 68, 0.3); }


/* =========================================
   MODAL EDITOR AVANZADO (Estructura)
   ========================================= */
.editor-post-card {
    display: grid;
    grid-template-columns: 1fr 1fr; 
    gap: 24px;
    background-color: #12141c; 
    border: 1px solid #1e2230;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    position: relative;
    transition: all 0.3s ease;
}

.editor-post-card.dragging {
    opacity: 0.5;
    transform: scale(0.98);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.card-col-left { display: flex; flex-direction: column; }
.card-col-right { display: flex; flex-direction: column; justify-content: space-between; }

.card-header-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }

.drag-handle { cursor: grab; color: #64748b; display: flex; align-items: center; padding: 4px; }
.drag-handle:active { cursor: grabbing; }

.post-title-badge { font-weight: 800; color: #f8fafc; font-size: 0.85rem; }

.badge-type {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.copy-textarea {
    width: 100%;
    height: 150px;
    background-color: #1a1d27;
    border: 1px solid #282d3d;
    border-radius: 12px;
    padding: 16px;
    color: #e2e8f0;
    font-size: 0.95rem;
    resize: none;
    outline: none;
    line-height: 1.5;
    margin-bottom: 16px;
}
.copy-textarea:focus { border-color: #6366f1; }

.btn-ai-generate {
    background: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: auto;
}

.btn-delete-post {
    position: absolute;
    top: 24px;
    right: 24px;
    background: transparent;
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-delete-post:hover { background: rgba(239, 68, 68, 0.1); }

/* =========================================
   MEDIA - CONTENEDORES 100% DINÁMICOS
   ========================================= */

.media-grid-dynamic {
    display: flex;
    gap: 16px;
    width: 100%;
    margin-bottom: 16px;
    align-items: stretch;
}

.media-box-dynamic {
    flex: 1;
    min-width: 0;
    background: #000;
    border-radius: 12px;
    border: 1px solid #27272a;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
}

/* La media dictará el alto real, hasta un máximo de 450px */
.media-content-dynamic {
    width: 100%;
    height: auto;
    max-height: 450px; 
    object-fit: contain; 
    display: block;
}

/* Placeholder cuando no hay video/imagen */
.media-placeholder {
    color: #52525b;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 60px 0;
}

/* =========================================
   BOTONES Y SLIDERS (Se mantienen igual)
   ========================================= */

.btn-remove-media-red {
    position: absolute;
    top: 8px; 
    right: 8px; 
    background: #ef4444; 
    color: white;
    border: none; 
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
    transition: transform 0.1s;
}
.btn-remove-media-red:hover { transform: scale(1.1); }

.slider-container {
    background-color: transparent;
    padding: 0;
    margin-top: 24px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.5px;
}

/* Input imitando Radix Slider */
.radix-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: #27272a; 
    border-radius: 999px;
    outline: none;
    cursor: pointer;
    position: relative;
}

.radix-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #8b5cf6;
    border: 2px solid #ffffff; 
    margin-top: -7px; 
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1), 0 2px 4px rgba(0,0,0,0.5);
    transition: box-shadow 0.2s, transform 0.1s;
}
.radix-slider::-webkit-slider-thumb:hover { box-shadow: 0 0 0 6px rgba(139, 92, 246, 0.2), 0 2px 4px rgba(0,0,0,0.5); }
.radix-slider::-webkit-slider-thumb:active { transform: scale(1.1); }

.slider-helper-text { font-size: 0.7rem; color: #475569; margin-top: 12px; text-align: center; }

.media-actions-row { display: flex; gap: 12px; margin-top: 12px; }
.btn-media-action {
    flex: 1;
    background: #18181b;
    color: #e2e8f0;
    border: 1px solid #27272a;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.btn-media-action:hover { background: #27272a; }

/* ── LA CAJA CONTENEDORA DEBE SER RELATIVA ── */
.media-box-dynamic {
    position: relative !important; /* Crítico para que la pantalla negra no se escape */
    overflow: hidden;
}

/* ── OVERLAY DE SUBIDA (DRAG & DROP) ── */
.upload-progress-overlay {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95) !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999 !important;
    color: white;
}

/* El nuevo icono giratorio dibujado con CSS */
.custom-spinner {
    width: 35px;
    height: 35px;
    margin-bottom: 12px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top: 3px solid #ffffff; /* Puedes cambiar #ffffff por #10b981 si lo quieres verde */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.upload-progress-overlay .upload-text {
    font-size: 1.05rem;
    font-weight: 500; /* Letra más fina (antes era 800) */
    font-family: inherit;
    text-align: center;
    letter-spacing: 0.5px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Efecto al arrastrar por encima */
.media-box-dynamic.drag-active {
    border: 2px dashed #10b981 !important;
    background-color: rgba(16, 185, 129, 0.1) !important;
    transform: scale(1.02);
    transition: all 0.2s ease;
}