/* Estilos para WC DTF Simple Frontend */

/* Contenedor principal del uploader */
.dtf-uploader-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Zona de drag and drop */
.dtf-drop-zone {
    border: 2px dashed #ccc;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    background-color: #f9f9f9;
    margin-bottom: 30px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.dtf-drop-zone.drag-over {
    border-color: #007cba;
    background-color: #e8f4f8;
}

.dtf-drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.dtf-upload-icon {
    color: #666;
    opacity: 0.7;
}

.dtf-upload-icon svg {
    width: 64px;
    height: 64px;
}

.dtf-drop-zone h3 {
    margin: 0;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

.dtf-upload-description {
    color: #666;
    font-size: 16px;
    margin: 0;
}

.dtf-upload-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.dtf-upload-btn {
    background-color: #007cba;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.dtf-upload-btn:hover {
    background-color: #005a87;
}

.dtf-upload-limits {
    font-size: 14px;
    color: #666;
}

/* Lista de archivos */
.dtf-files-list {
    margin-bottom: 30px;
}

.dtf-files-list h4 {
    margin-bottom: 20px;
    color: #333;
    font-size: 20px;
}

.dtf-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Tarjeta de archivo */
.dtf-file-card {
    background: white;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
}

.dtf-file-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.dtf-file-card.invalid {
    border-color: #dc3545;
    background-color: #fdf2f2;
}

.dtf-file-card.valid {
    border-color: #28a745;
    background-color: #f2fdf2;
}

.dtf-file-preview {
    position: relative;
    width: 100%;
    height: 150px;
    background-color: #f8f8f8;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.dtf-file-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dtf-file-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dtf-file-preview:hover .dtf-file-preview-overlay {
    opacity: 1;
}

.dtf-preview-btn {
    background: white;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    color: #007cba;
}

.dtf-file-info {
    margin-bottom: 15px;
}

.dtf-file-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.dtf-file-name {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    word-break: break-word;
}

.dtf-file-remove {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.dtf-file-remove:hover {
    background-color: #f8d7da;
}

.dtf-file-details {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.dtf-file-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dtf-copies-label {
    font-size: 14px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dtf-copies-input {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.dtf-file-meters {
    font-weight: 600;
    color: #007cba;
}

.dtf-file-validation {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px;
    border-radius: 4px;
    font-size: 14px;
}

.dtf-file-validation.valid {
    background-color: #d4edda;
    color: #155724;
}

.dtf-file-validation.invalid {
    background-color: #f8d7da;
    color: #721c24;
}

.dtf-validation-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.dtf-validation-icon.valid {
    background-color: #28a745;
    color: white;
}

.dtf-validation-icon.invalid {
    background-color: #dc3545;
    color: white;
}

.dtf-validation-icon.valid::before {
    content: "✓";
}

.dtf-validation-icon.invalid::before {
    content: "✗";
}

/* Barra métrica sticky */
.dtf-metric-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e1e1e1;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    padding: 15px 20px;
    z-index: 1000;
}

.dtf-metric-bar-content {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    gap: 20px;
}

.dtf-metric-left {
    text-align: left;
}

.dtf-metric-center {
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.dtf-metric-right {
    text-align: right;
}

.dtf-total-meters,
.dtf-price-per-meter,
.dtf-discount,
.dtf-total-price {
    font-size: 16px;
    color: #333;
}

.dtf-total-price {
    font-size: 18px;
    font-weight: bold;
    color: #007cba;
}

.dtf-actions {
    margin-top: 15px;
    text-align: center;
}

.dtf-add-to-cart-btn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 5px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
    min-width: 200px;
}

.dtf-add-to-cart-btn:hover:not(:disabled) {
    background-color: #218838;
}

.dtf-add-to-cart-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

/* Modal de vista previa */
.dtf-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dtf-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    cursor: pointer;
}

.dtf-modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80%;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.dtf-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e1e1e1;
}

.dtf-modal-header h3 {
    margin: 0;
    color: #333;
}

.dtf-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dtf-modal-close:hover {
    color: #333;
}

.dtf-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dtf-preview-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.dtf-preview-ruler {
    width: 40px;
    background: #f8f8f8;
    border-right: 1px solid #e1e1e1;
    position: relative;
}

.dtf-preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.dtf-preview-tile {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    border-radius: 4px;
}

.dtf-preview-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-top: 1px solid #e1e1e1;
}

.dtf-zoom-btn {
    background: #007cba;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.dtf-zoom-btn:hover {
    background-color: #005a87;
}

.dtf-zoom-level {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

/* Indicador de carga */
.dtf-loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    text-align: center;
    z-index: 10001;
}

.dtf-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mensajes de error */
.dtf-error-messages {
    margin-top: 20px;
}

.dtf-error-message {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.dtf-error-message.success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.dtf-error-message.info {
    background-color: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

/* Regla métrica */
.dtf-ruler-mark {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: #ccc;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 5px;
    font-size: 10px;
    color: #666;
}

/* Responsive design */
@media (max-width: 768px) {
    .dtf-uploader-container {
        padding: 15px;
    }
    
    .dtf-drop-zone {
        padding: 30px 15px;
    }
    
    .dtf-drop-zone h3 {
        font-size: 20px;
    }
    
    .dtf-files-grid {
        grid-template-columns: 1fr;
    }
    
    .dtf-metric-bar-content {
        grid-template-columns: 1fr;
        gap: 10px;
        text-align: center;
    }
    
    .dtf-metric-center {
        flex-direction: column;
        gap: 10px;
    }
    
    .dtf-modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .dtf-preview-container {
        flex-direction: column;
    }
    
    .dtf-preview-ruler {
        width: auto;
        height: 30px;
        border-right: none;
        border-bottom: 1px solid #e1e1e1;
    }
}

/* Utilidades */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.dtf-hidden {
    display: none !important;
}

.dtf-visible {
    display: block !important;
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-10px); }
}

.dtf-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.dtf-fade-out {
    animation: fadeOut 0.3s ease-out;
}

/* Estados de carga */
.dtf-loading {
    opacity: 0.6;
    pointer-events: none;
}

.dtf-processing {
    position: relative;
}

.dtf-processing::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    z-index: 1;
}

.dtf-processing::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 2;
} 

/* ====================================
   MODAL DE VISTA PREVIA
   ==================================== */

.dtf-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dtf-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
}

.dtf-modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    height: 85%;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: dtfModalSlideIn 0.3s ease-out;
}

@keyframes dtfModalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.dtf-modal-header {
    background: linear-gradient(135deg, #673ab7, #9c27b0);
    color: white;
    padding: 20px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px 12px 0 0;
}

.dtf-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.dtf-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dtf-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.dtf-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    position: relative;
}

/* Opciones de visualizador PDF */
.dtf-pdf-viewer-options {
    padding: 30px;
    text-align: center;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-bottom: 1px solid #dee2e6;
}

.dtf-pdf-viewer-options h4 {
    margin: 0 0 20px 0;
    color: #343a40;
    font-size: 20px;
    font-weight: 600;
}

.dtf-viewer-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.dtf-viewer-btn {
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 20px 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 160px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.dtf-viewer-btn:hover {
    border-color: #673ab7;
    background: #f8f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(103, 58, 183, 0.2);
}

.dtf-viewer-btn .dashicons {
    font-size: 32px;
    color: #673ab7;
}

.dtf-viewer-btn span:not(.dashicons) {
    font-weight: 600;
    color: #343a40;
}

.dtf-pdf-viewer-options .description {
    color: #6c757d;
    font-size: 14px;
    line-height: 1.5;
    max-width: 500px;
    margin: 0 auto;
}

/* Visualizador PDF completo */
.dtf-pdf-full-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.dtf-pdf-info {
    background: white;
    padding: 15px 25px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.dtf-pdf-info h4 {
    margin: 0;
    color: #343a40;
    font-size: 16px;
    font-weight: 600;
}

.dtf-pdf-info p {
    margin: 0;
    color: #6c757d;
    font-size: 14px;
}

.dtf-pdf-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.dtf-back-to-tiles {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 15px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dtf-back-to-tiles:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.dtf-open-original {
    color: #673ab7;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: color 0.3s ease;
}

.dtf-open-original:hover {
    color: #563098;
    text-decoration: underline;
}

.dtf-pdf-iframe-container {
    flex: 1;
    position: relative;
    background: #f8f9fa;
}

.dtf-pdf-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* Estados de carga y error para PDF */
.dtf-loading-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #6c757d;
    font-size: 16px;
    text-align: center;
}

.dtf-loading-preview::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid #e9ecef;
    border-top: 3px solid #673ab7;
    border-radius: 50%;
    animation: dtfSpin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes dtfSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.dtf-preview-error {
    padding: 40px 20px;
    text-align: center;
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    margin: 20px;
    font-size: 16px;
}

/* Responsive para visualizador PDF */
@media (max-width: 768px) {
    .dtf-modal-content {
        width: 95%;
        height: 95%;
        border-radius: 8px;
    }
    
    .dtf-modal-header {
        padding: 15px 20px;
        border-radius: 8px 8px 0 0;
    }
    
    .dtf-modal-header h3 {
        font-size: 16px;
    }
    
    .dtf-viewer-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .dtf-viewer-btn {
        min-width: 200px;
    }
    
    .dtf-pdf-info {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px 20px;
    }
    
    .dtf-pdf-controls {
        width: 100%;
        justify-content: space-between;
    }
} 