/* ============================================================================
   Smart Task EDU — Selector de archivos drag & drop
   ----------------------------------------------------------------------------
   Mejora visual progresiva de todos los <input type="file"> del sistema.
   Convierte el botón nativo en un bloque donde se pueden arrastrar y soltar
   archivos, mostrando una previsualización con código de color según el tipo
   (video, PDF, imagen, audio, documento, etc.).

   Usa las variables del tema unificado (smarttask-theme.css) con valores de
   reserva para funcionar también en las vistas públicas que no lo cargan.
   ========================================================================== */

/* Bloque contenedor */
.st-dropzone {
    position: relative;
    display: block;
    width: 100%;
    border: 2px dashed var(--st-border-strong, #CBD5E1);
    border-radius: var(--st-radius-md, 12px);
    background: var(--st-bg-soft, #F1F5F9);
    padding: 1.25rem 1rem;
    cursor: pointer;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.st-dropzone:hover {
    border-color: var(--st-primary, #2F6BFF);
    background: var(--st-primary-light, #EAF1FF);
}

/* Estado mientras se arrastra un archivo encima */
.st-dropzone.is-dragover {
    border-color: var(--st-primary, #2F6BFF);
    background: var(--st-primary-light, #EAF1FF);
    box-shadow: 0 0 0 3px rgba(var(--st-primary-rgb, 47, 107, 255), .18);
}

.st-dropzone.has-error {
    border-color: var(--st-danger, #EF4444);
    background: var(--st-danger-light, #FEF2F2);
}

/* Zona de invitación (icono + texto) */
.st-dropzone__prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: .35rem;
    pointer-events: none;
}

.st-dropzone__icon {
    font-size: 2rem;
    line-height: 1;
    color: var(--st-primary, #2F6BFF);
    margin-bottom: .15rem;
}

.st-dropzone__title {
    font-size: .92rem;
    font-weight: 600;
    color: var(--st-text, #0F172A);
}

.st-dropzone__title .st-dropzone__link {
    color: var(--st-primary, #2F6BFF);
    text-decoration: underline;
}

.st-dropzone__hint {
    font-size: .76rem;
    color: var(--st-text-secondary, #64748B);
}

/* Input nativo: oculto visualmente pero presente para el envío y la
   validación (mantiene tamaño 1px para no ser :hidden en jQuery validate). */
.st-file-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
}

/* Compañeros del patrón heredado (campo de texto + botón "Upload") que el
   dropzone reemplaza visualmente. */
.st-legacy-hidden {
    display: none !important;
}

/* Lista de archivos seleccionados */
.st-dropzone__files {
    list-style: none;
    margin: 0;
    padding: 0;
}

.st-dropzone__files:not(:empty) {
    margin-top: .9rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.st-file {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .5rem .65rem;
    background: var(--st-card, #FFFFFF);
    border: 1px solid var(--st-border, #E5E7EB);
    border-left-width: 4px;
    border-radius: var(--st-radius-sm, 8px);
    box-shadow: var(--st-shadow-soft, 0 2px 6px rgba(15, 23, 42, .04));
}

/* Caja del icono / miniatura, coloreada por tipo */
.st-file__thumb {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    overflow: hidden;
}

.st-file__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.st-file__meta {
    flex: 1 1 auto;
    min-width: 0;
}

.st-file__name {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--st-text, #0F172A);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.st-file__sub {
    display: block;
    font-size: .72rem;
    color: var(--st-text-secondary, #64748B);
}

.st-file__badge {
    font-weight: 600;
}

.st-file__remove {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: var(--st-text-muted, #94A3B8);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: .3rem .45rem;
    border-radius: 6px;
    transition: color .15s ease, background-color .15s ease;
}

.st-file__remove:hover {
    color: var(--st-danger, #EF4444);
    background: var(--st-danger-light, #FEF2F2);
}

/* ----- Código de color por tipo de archivo ----- */
.st-file[data-cat="image"]      { border-left-color: #16A34A; }
.st-file[data-cat="image"]      .st-file__thumb { background: #16A34A; }
.st-file[data-cat="image"]      .st-file__badge { color: #16A34A; }

.st-file[data-cat="pdf"]        { border-left-color: #DC2626; }
.st-file[data-cat="pdf"]        .st-file__thumb { background: #DC2626; }
.st-file[data-cat="pdf"]        .st-file__badge { color: #DC2626; }

.st-file[data-cat="video"]      { border-left-color: #7C3AED; }
.st-file[data-cat="video"]      .st-file__thumb { background: #7C3AED; }
.st-file[data-cat="video"]      .st-file__badge { color: #7C3AED; }

.st-file[data-cat="audio"]      { border-left-color: #0891B2; }
.st-file[data-cat="audio"]      .st-file__thumb { background: #0891B2; }
.st-file[data-cat="audio"]      .st-file__badge { color: #0891B2; }

.st-file[data-cat="word"]       { border-left-color: #2563EB; }
.st-file[data-cat="word"]       .st-file__thumb { background: #2563EB; }
.st-file[data-cat="word"]       .st-file__badge { color: #2563EB; }

.st-file[data-cat="excel"]      { border-left-color: #15803D; }
.st-file[data-cat="excel"]      .st-file__thumb { background: #15803D; }
.st-file[data-cat="excel"]      .st-file__badge { color: #15803D; }

.st-file[data-cat="powerpoint"] { border-left-color: #EA580C; }
.st-file[data-cat="powerpoint"] .st-file__thumb { background: #EA580C; }
.st-file[data-cat="powerpoint"] .st-file__badge { color: #EA580C; }

.st-file[data-cat="archive"]    { border-left-color: #B45309; }
.st-file[data-cat="archive"]    .st-file__thumb { background: #B45309; }
.st-file[data-cat="archive"]    .st-file__badge { color: #B45309; }

.st-file[data-cat="code"]       { border-left-color: #475569; }
.st-file[data-cat="code"]       .st-file__thumb { background: #475569; }
.st-file[data-cat="code"]       .st-file__badge { color: #475569; }

.st-file[data-cat="other"]      { border-left-color: #64748B; }
.st-file[data-cat="other"]      .st-file__thumb { background: #64748B; }
.st-file[data-cat="other"]      .st-file__badge { color: #64748B; }

/* Mensaje de archivos rechazados */
.st-dropzone__error {
    margin-top: .6rem;
    font-size: .76rem;
    color: var(--st-danger, #EF4444);
}

/* Variante compacta para inputs pequeños (form-control-sm) */
.st-dropzone.st-dropzone--sm {
    padding: .85rem .75rem;
}
.st-dropzone.st-dropzone--sm .st-dropzone__icon { font-size: 1.5rem; }
.st-dropzone.st-dropzone--sm .st-dropzone__title { font-size: .82rem; }
