﻿.cfn-creator-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

.cfn-creator-header {
    text-align: center;
    margin-bottom: 30px;
}

.cfn-creator-header h1 {
    color: #1e293b;
    font-size: 2.2em;
    margin-bottom: 10px;
}

.cfn-token-display {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

#cfn-drop-zone {
    border: 3px dashed #cbd5e1;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    background-color: #f8fafc;
    transition: all 0.3s ease;
    cursor: pointer;
}

#cfn-drop-zone:hover {
    border-color: #667eea;
    background-color: #f1f5f9;
}

#cfn-drop-zone.cfn-drag-over {
    border-color: #667eea;
    background-color: #e0e7ff;
    transform: scale(1.02);
}

.cfn-upload-icon {
    font-size: 64px;
    color: #94a3b8;
    margin-bottom: 20px;
}

#cfn-drop-zone h2 {
    color: #475569;
    font-size: 1.5em;
    margin-bottom: 10px;
}

#cfn-drop-zone p {
    color: #64748b;
    margin-bottom: 20px;
}

.cfn-btn {
    display: inline-block;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    margin: 5px;
}

.cfn-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.3);
}

.cfn-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

.cfn-btn-secondary {
    background-color: #e2e8f0;
    color: #475569;
}

.cfn-btn-secondary:hover {
    background-color: #cbd5e1;
}

#cfn-file-input {
    display: none;
}

#cfn-preview-container {
    display: none;
}

.cfn-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

@media (min-width: 1024px) {
    .cfn-preview-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.cfn-preview-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.cfn-preview-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.cfn-preview-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 15px;
    background-color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cfn-preview-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cfn-preview-info h4 {
    color: #1e293b;
    font-size: 14px;
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cfn-orientation-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.cfn-orientation-selector label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: #475569;
    cursor: pointer;
}

.cfn-orientation-selector input[type="radio"] {
    cursor: pointer;
}

.cfn-size-selector {
    margin-top: 10px;
}

.cfn-size-selector label {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 6px;
    font-weight: 500;
}

.cfn-size-select {
    width: 100%;
    padding: 10px 40px 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #1e293b;
    font-weight: 500;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14"%3E%3Cpath fill="%23475569" d="M7 10L2 5h10z"/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
    min-height: 44px;
    line-height: 1.4;
}

.cfn-size-select:hover {
    border-color: #3b82f6;
    background-color: #f8fafc;
}

.cfn-size-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background-color: white;
}

.cfn-size-select option {
    padding: 8px;
    font-size: 13px;
}

/* Calidad de imagen */
.cfn-quality-selector {
    margin-top: 12px;
    padding: 12px;
    background-color: #fef3c7;
    border: 2px solid #fbbf24;
    border-radius: 8px;
}

.cfn-quality-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.cfn-quality-checkbox input[type="checkbox"] {
    margin-top: 2px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.cfn-quality-checkbox > div {
    flex: 1;
}

.cfn-quality-checkbox strong {
    display: block;
    font-size: 13px;
    color: #92400e;
    font-weight: 600;
    margin-bottom: 2px;
}

.cfn-quality-checkbox small {
    display: block;
    font-size: 11px;
    color: #b45309;
    line-height: 1.4;
}

.cfn-remove-preview {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    background-color: #ef4444;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.cfn-remove-preview::before {
    content: "×";
    font-size: 28px;
    font-weight: bold;
    color: white;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.cfn-remove-preview:hover {
    background-color: #dc2626;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

.cfn-cost-summary {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.cfn-cost-summary h3 {
    color: #1e293b;
    margin-bottom: 10px;
}

#cfn-total-cost {
    font-size: 2em;
    color: #667eea;
    font-weight: 700;
}

.cfn-action-buttons {
    text-align: center;
}

#cfn-processing {
    display: none;
    text-align: center;
    padding: 60px 20px;
}

.cfn-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: cfn-spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes cfn-spin {
    to { transform: rotate(360deg); }
}

#cfn-processing h2 {
    color: #475569;
    margin-bottom: 10px;
}

.cfn-success-message {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.cfn-success-message h2 {
    color: #10b981;
    font-size: 2em;
    margin-bottom: 15px;
}

.cfn-success-message p {
    color: #475569;
    font-size: 1.1em;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .cfn-creator-container {
        padding: 10px;
    }
    
    #cfn-preview-grid {
        grid-template-columns: 1fr;
    }
    
    .cfn-creator-header h1 {
        font-size: 1.8em;
    }
    
    .cfn-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}
/* ============ MODAL DE VISTA PREVIA ============ */

.cfn-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.cfn-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.cfn-modal-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    margin: 5vh auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cfn-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.cfn-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: white;
}

.cfn-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: white;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.cfn-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.cfn-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.cfn-modal-preview-wrapper {
    position: relative;
    margin-bottom: 24px;
}

.cfn-modal-preview {
    width: 100%;
    min-height: 400px;
    max-height: 500px;
    background: #f8fafc;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 2px solid #e2e8f0;
    overflow: auto;
    padding: 20px;
}

#cfn-modal-preview-box {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.cfn-modal-preview.zoomed {
    cursor: grab;
}

.cfn-modal-preview.zoomed:active {
    cursor: grabbing;
}

.cfn-preview-loader {
    text-align: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    background: rgba(248, 250, 252, 0.9);
    padding: 20px;
    border-radius: 12px;
    pointer-events: none;
}

.cfn-preview-loader.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.cfn-preview-loader p {
    color: #64748b;
    font-size: 14px;
    margin-top: 12px;
}

#cfn-preview-image {
    width: auto;
    height: auto;
    min-width: 200px;
    min-height: 200px;
    max-width: 100%;
    max-height: 500px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    transform-origin: center center;
    user-select: none;
    -webkit-user-drag: none;
    position: relative;
    z-index: 15;
    display: none; /* Empieza oculta, JavaScript la muestra cuando cargue */
    object-fit: contain;
}

.cfn-zoom-controls {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.cfn-zoom-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #667eea;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
}

.cfn-zoom-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.1);
}

.cfn-zoom-btn:active {
    transform: scale(0.95);
}

.cfn-zoom-icon {
    display: block;
    line-height: 1;
}

.cfn-modal-controls {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
}

.cfn-modal-controls h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: #1e293b;
    font-weight: 600;
}

.cfn-level-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.cfn-level-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.cfn-level-option:hover {
    border-color: #667eea;
    background: #f8fafc;
}

.cfn-level-option input[type=radio] {
    margin-right: 10px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.cfn-level-option input[type=radio]:checked + span {
    color: #667eea;
    font-weight: 600;
}

.cfn-level-option span {
    font-size: 14px;
    color: #475569;
    transition: all 0.3s ease;
}

.cfn-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #f8fafc;
}

body.cfn-modal-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    .cfn-modal-content {
        width: 95%;
        max-height: 95vh;
        margin: 2.5vh auto;
    }
    
    .cfn-modal-header {
        padding: 16px;
    }
    
    .cfn-modal-body {
        padding: 16px;
    }
    
    .cfn-level-options {
        grid-template-columns: 1fr 1fr;
    }
    
    #cfn-preview-image {
        max-height: 300px;
    }
    
    .cfn-modal-preview {
        min-height: 250px;
        max-height: 350px;
    }
    
    .cfn-zoom-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
}

/* Modal de Error */
.cfn-error-modal-content {
    max-width: 500px;
    animation: cfnErrorShake 0.5s ease;
}

@keyframes cfnErrorShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.cfn-error-header {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: white !important;
}

.cfn-error-header h3 {
    color: white !important;
    font-size: 20px;
    font-weight: 600;
}

.cfn-error-body {
    padding: 30px 24px;
    text-align: center;
}

.cfn-error-body p {
    font-size: 16px;
    color: #1e293b;
    line-height: 1.6;
    margin: 0;
}

.cfn-error-ok {
    min-width: 120px;
}

.cfn-error-modal-content .cfn-modal-footer {
    justify-content: center;
    background: white;
}
