/* ==========================================================================
   Estilos Específicos para Herramientas (Workspace)
   ========================================================================== */

.tool-page {
    background-color: #0f0f0f;
    /* Un poco más oscuro que el fondo normal para enfoque */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.fixed-nav {
    position: relative !important;
    background-color: var(--navbar-bg-scrolled) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.workspace-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 4%;
    flex-grow: 1;
    width: 100%;
}

.tool-header {
    text-align: center;
    margin-bottom: 40px;
}

.tool-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.tool-description {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.tool-description b {
    color: var(--match-green);
    font-weight: 600;
}

/* ==========================================================================
   Zona Drag & Drop
   ========================================================================== */
.upload-section {
    background-color: #1a1a1a;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 60px 20px;
    text-align: center;
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.upload-section:hover,
.upload-section.dragover {
    border-color: var(--primary-color);
    background-color: rgba(229, 9, 20, 0.05);
}

.upload-section.dragover {
    transform: scale(1.02);
}

.upload-icon {
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 20px;
    transition: color var(--transition-fast), transform var(--transition-smooth);
}

.upload-section:hover .upload-icon,
.upload-section.dragover .upload-icon {
    color: var(--primary-color);
    transform: translateY(-5px);
}

.upload-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.upload-hint {
    color: var(--text-muted);
    margin-bottom: 25px;
}

.hidden-input {
    display: none;
}

.btn-upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 30px;
    font-size: 1.1rem;
    margin: 0 auto;
    /* Botón animado estilo Netflix */
    background-color: var(--primary-color);
    color: white;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(229, 9, 20, 0.2);
}

.btn-upload:hover {
    background-color: var(--primary-color-hover);
    box-shadow: 0 6px 12px rgba(229, 9, 20, 0.4);
    transform: translateY(-2px);
}

/* ==========================================================================
   Vista de Archivos Subidos (Sortable Grid)
   ========================================================================== */
.hidden {
    display: none !important;
}

.files-preview-section {
    margin-top: 40px;
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.preview-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-hint::before {
    content: "↕";
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.4);
}

/* GRID de Tarjetas de Archivos */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.file-card {
    background-color: #222;
    border-radius: 6px;
    padding: 15px;
    position: relative;
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
}

.file-card:active {
    cursor: grabbing;
}

.file-card:hover {
    background-color: #2a2a2a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Clase inyectada por SortableJS al mover un elemento */
.sortable-ghost {
    opacity: 0.4;
    background-color: var(--bg-color);
    border: 1px dashed var(--primary-color);
}

.file-card-number {
    position: absolute;
    top: -8px;
    left: -8px;
    background-color: white;
    color: black;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.btn-remove-file {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

.file-card:hover .btn-remove-file {
    opacity: 1;
}

.btn-remove-file:hover {
    background: var(--primary-color);
}

/* Icono Visual del PDF */
.file-visual {
    width: 100%;
    height: 80px;
    background: linear-gradient(135deg, #333 0%, #222 100%);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    color: rgba(255, 255, 255, 0.7);
}

.file-visual svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.file-info {
    flex-grow: 1;
    overflow: hidden;
}

.file-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.file-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Barra de Acciones Inferior
   ========================================================================== */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.4);
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-action-main {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--primary-color);
    color: white;
    padding: 12px 30px;
    box-shadow: 0 4px 15px rgba(229, 9, 20, 0.4);
}

.btn-action-main:disabled {
    background-color: #333;
    color: #666;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-action-main:not(:disabled):hover {
    background-color: var(--primary-color-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(229, 9, 20, 0.6);
}

/* ==========================================================================
   Overlay de Carga (Spinner)
   ========================================================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(229, 9, 20, 0.3);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-text {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-color);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}