/* JettaPrint Configurator Styles */

:root {
    --jp-primary: #2271b1;
    --jp-primary-hover: #135e96;
    --jp-success: #00a32a;
    --jp-danger: #d63638;
    --jp-warning: #dba617;
    --jp-border: #dcdcde;
    --jp-bg-light: #f6f7f7;
    --jp-text: #1d2327;
    --jp-text-light: #646970;
    --jp-radius: 8px;
    --jp-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --jp-shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
}

.jettaprint-configurator {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

/* Header */
.jettaprint-header {
    text-align: center;
    margin-bottom: 16px;
}

.jettaprint-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--jp-text);
    margin: 0 0 4px;
    line-height: 1.2;
}

.jettaprint-subtitle {
    font-size: 14px;
    color: var(--jp-text-light);
    margin: 0;
    line-height: 1.3;
}

/* Progress Steps */
.jettaprint-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    position: relative;
}

.jettaprint-steps::before {
    content: '';
    position: absolute;
    top: 14px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--jp-border);
    z-index: 0;
}

.jettaprint-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    cursor: pointer;
    transition: all 0.3s ease;
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--jp-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    color: var(--jp-text-light);
    margin-bottom: 4px;
    transition: all 0.3s ease;
}

.step-label {
    font-size: 12px;
    color: var(--jp-text-light);
    font-weight: 500;
}

.jettaprint-step.active .step-number {
    background: var(--jp-primary);
    border-color: var(--jp-primary);
    color: white;
}

.jettaprint-step.active .step-label {
    color: var(--jp-primary);
}

.jettaprint-step.completed .step-number {
    background: var(--jp-success);
    border-color: var(--jp-success);
    color: white;
}

/* Content Panels */
.jettaprint-content {
    background: white;
    border-radius: var(--jp-radius);
    box-shadow: var(--jp-shadow);
    padding: 24px 30px;
    margin-bottom: 20px;
}

.jettaprint-panel {
    display: none;
}

.jettaprint-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.jettaprint-panel h3 {
    font-size: 24px;
    margin: 0 0 30px;
    color: var(--jp-text);
}

/* Upload Area */
.jettaprint-upload-area {
    border: 2px dashed var(--jp-border);
    border-radius: var(--jp-radius);
    padding: 60px 40px;
    text-align: center;
    background: var(--jp-bg-light);
    transition: all 0.3s ease;
}

.jettaprint-upload-area:hover,
.jettaprint-upload-area.dragover {
    border-color: var(--jp-primary);
    background: #f0f6fc;
}

.upload-icon {
    color: var(--jp-primary);
    margin-bottom: 20px;
}

.upload-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--jp-text);
    margin: 0 0 10px;
}

.upload-hint {
    font-size: 14px;
    color: var(--jp-text-light);
    margin: 0 0 20px;
}

/* File List */
.jettaprint-file-list {
    margin-top: 30px;
}

.file-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.file-list-header h4 {
    margin: 0;
    font-size: 18px;
}

.button-link {
    background: none;
    border: none;
    color: var(--jp-primary);
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    text-decoration: underline;
}

.button-link:hover {
    color: var(--jp-primary-hover);
}

.file-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .file-items {
        grid-template-columns: 1fr;
    }
}

.file-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--jp-bg-light);
    border-radius: var(--jp-radius);
    border: 1px solid var(--jp-border);
    overflow: hidden;
    max-width: 100%;
}

.file-item.uploading {
    opacity: 0.7;
}

.file-item.waiting {
    opacity: 0.5;
}

.file-item.waiting .file-actions,
.file-item.uploading .file-actions {
    opacity: 0.3;
    pointer-events: none;
}

.waiting-text {
    color: #999;
    font-style: italic;
}

.image-icon svg {
    color: #10b981;
}

.pdf-icon svg {
    color: var(--jp-primary);
}

/* Upload spinner */
.upload-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid rgba(34, 113, 177, 0.2);
    border-top-color: var(--jp-primary);
    border-radius: 50%;
    animation: spinner-rotate 0.8s linear infinite;
    z-index: 10;
}

@keyframes spinner-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.uploading-text {
    color: var(--jp-primary);
    font-style: italic;
}

.file-icon {
    position: relative;
}

.file-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.file-icon svg {
    width: 100%;
    height: 100%;
    color: var(--jp-primary);
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    color: var(--jp-text);
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 13px;
    color: var(--jp-text-light);
}

.file-actions {
    display: flex;
    gap: 8px;
}

.file-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.file-action-btn:hover {
    background: rgba(0,0,0,0.05);
}

.file-action-btn svg {
    width: 20px;
    height: 20px;
    color: var(--jp-text-light);
}

.file-action-btn.delete:hover svg {
    color: var(--jp-danger);
}

.file-list-summary {
    padding: 15px;
    background: #f0f6fc;
    border-radius: var(--jp-radius);
    text-align: center;
    font-size: 15px;
}

/* Configuration Grid */
.jettaprint-config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.config-group {
    display: flex;
    flex-direction: column;
}

.config-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--jp-text);
    font-size: 14px;
}

.config-select,
.config-input {
    padding: 12px 16px;
    border: 1px solid var(--jp-border);
    border-radius: 6px;
    font-size: 15px;
    background: white;
    transition: all 0.2s;
    line-height: 1.5;
    height: auto;
    min-height: 44px;
}

.config-select:focus,
.config-input:focus {
    outline: none;
    border-color: var(--jp-primary);
    box-shadow: 0 0 0 1px var(--jp-primary);
}

.radio-group {
    display: flex;
    gap: 15px;
}

.radio-option {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border: 2px solid var(--jp-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-option:hover {
    border-color: var(--jp-primary);
}

.radio-option input[type="radio"] {
    margin-right: 10px;
    flex-shrink: 0;
}

.radio-option span {
    flex: 1;
}

.radio-option input[type="radio"]:checked + span {
    font-weight: 600;
}

.radio-option:has(input:checked) {
    border-color: var(--jp-primary);
    background: #f0f6fc;
}

.field-hint {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--jp-text-light);
    font-style: italic;
}

/* Acabamentos Grid */
.acabamentos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.acabamento-card {
    border: 2px solid var(--jp-border);
    border-radius: var(--jp-radius);
    overflow: hidden;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.acabamento-card:hover {
    border-color: var(--jp-primary);
    box-shadow: var(--jp-shadow);
}

.acabamento-checkbox {
    display: flex;
    flex-direction: column;
    flex: 1;
    cursor: pointer;
    width: 100%;
}

.acabamento-checkbox input[type="checkbox"] {
    display: none;
}

.acabamento-info {
    padding: 20px;
    flex: 1;
}

.acabamento-checkbox:has(input:checked) .acabamento-info {
    background: #f0f6fc;
}

.acabamento-checkbox:has(input:checked) ~ .acabamento-card {
    border-color: var(--jp-primary);
}

.acabamento-card:has(input:checked) {
    border-color: var(--jp-primary);
}

.acabamento-info strong {
    display: block;
    font-size: 16px;
    margin-bottom: 6px;
    color: var(--jp-text);
}

.acabamento-info p {
    font-size: 13px;
    color: var(--jp-text-light);
    margin: 0 0 10px;
}

.acabamento-price {
    display: inline-block;
    font-weight: 600;
    color: var(--jp-primary);
    font-size: 14px;
}

/* Summary */
.jettaprint-summary {
    display: grid;
    gap: 25px;
}

.summary-section {
    padding: 20px;
    background: var(--jp-bg-light);
    border-radius: var(--jp-radius);
}

.summary-section h4 {
    margin: 0 0 15px;
    font-size: 18px;
    color: var(--jp-text);
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 15px;
}

.summary-item strong {
    color: var(--jp-text);
}

.summary-item span {
    color: var(--jp-text-light);
}

.price-breakdown {
    background: #f0f6fc;
    border: 2px solid var(--jp-primary);
}

.price-breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(34, 113, 177, 0.1);
}

.price-breakdown-item:last-child {
    border-bottom: none;
    padding-top: 15px;
    margin-top: 10px;
    border-top: 2px solid var(--jp-primary);
    font-weight: 700;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px;
    background: var(--jp-primary);
    color: white;
    border-radius: var(--jp-radius);
    font-size: 20px;
}

.summary-total strong {
    font-size: 28px;
}

/* Actions */
.jettaprint-actions {
    display: flex;
    gap: 15px;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

/* Aviso lado esquerdo no step 1 */
.jettaprint-actions .actions-left {
    flex: 1;
    display: flex;
    align-items: center;
}

.jettaprint-actions .actions-right {
    display: flex;
    gap: 15px;
    align-items: center;
}

.inline-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding: 12px 20px;
    background: #f0f6fc;
    border: 2px solid var(--jp-primary);
    border-radius: 6px;
}

.inline-price .price-label {
    font-size: 12px;
    color: var(--jp-text-light);
    margin-bottom: 2px;
}

.inline-price .price-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--jp-primary);
    line-height: 1;
}

.button {
    padding: 12px 24px;
    border-radius: 6px;
    border: 1px solid var(--jp-border);
    background: white;
    color: var(--jp-text);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.button:hover {
    background: var(--jp-bg-light);
}

.button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.button-primary {
    background: var(--jp-primary);
    border-color: var(--jp-primary);
    color: white;
}

.button-primary:hover:not(:disabled) {
    background: var(--jp-primary-hover);
    border-color: var(--jp-primary-hover);
}

.button-large {
    padding: 14px 32px;
    font-size: 16px;
}

.button-hero {
    font-size: 18px;
    padding: 16px 40px;
}

/* Price Preview (Sticky) - Escondido por padrão, mostrado apenas inline */
.jettaprint-price-preview {
    display: none;
}

.jettaprint-price-preview.collapsed {
    padding: 12px;
    min-width: auto;
}

.jettaprint-price-preview.collapsed .price-preview-content {
    display: none;
}

.price-preview-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.price-label {
    font-size: 14px;
    color: var(--jp-text-light);
}

.price-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--jp-primary);
}

.price-preview-toggle {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--jp-primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--jp-shadow);
}

.price-preview-toggle:hover {
    background: var(--jp-primary-hover);
}

/* Loading Overlay */
.jettaprint-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: white;
    margin-top: 20px;
    font-size: 16px;
    font-weight: 600;
    white-space: pre-line;
    text-align: center;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
    .jettaprint-configurator {
        padding: 0 15px;
    }
    
    .jettaprint-content {
        padding: 25px 20px;
    }
    
    .jettaprint-steps {
        overflow-x: auto;
        padding-bottom: 10px;
    }
    
    .jettaprint-step {
        flex-shrink: 0;
    }
    
    .step-label {
        font-size: 12px;
    }
    
    .jettaprint-config-grid {
        grid-template-columns: 1fr;
    }
    
    .acabamentos-grid {
        grid-template-columns: 1fr;
    }
    
    .jettaprint-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .jettaprint-actions .actions-right {
        flex-direction: column-reverse;
        align-items: stretch;
        width: 100%;
    }
    
    .inline-price {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .inline-price .price-label {
        font-size: 14px;
    }
    
    .inline-price .price-value {
        font-size: 20px;
    }
    
    .button {
        width: 100%;
        text-align: center;
    }
    
    .radio-group {
        flex-direction: column;
    }
}

/* Custom Modal */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.custom-modal {
    background: white;
    border-radius: 12px;
    padding: 40px 30px 30px;
    max-width: 480px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.custom-modal-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: scaleIn 0.4s ease 0.2s backwards;
}

@keyframes scaleIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.custom-modal-title {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 15px 0;
}

.custom-modal-message {
    font-size: 16px;
    color: #555;
    margin: 0 0 30px 0;
    line-height: 1.5;
}

.custom-modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.custom-modal-btn {
    flex: 1;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.custom-modal-btn.btn-primary {
    background: var(--jp-primary);
    color: white;
}

.custom-modal-btn.btn-primary:hover {
    background: #1a5fa8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
}

.custom-modal-btn.btn-secondary {
    background: #00a32a;
    color: white;
}

.custom-modal-btn.btn-secondary:hover {
    background: #008a24;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 163, 42, 0.3);
}

@media (max-width: 600px) {
    .custom-modal {
        padding: 30px 20px 20px;
    }
    
    .custom-modal-buttons {
        flex-direction: column;
    }
    
    .custom-modal-btn {
        width: 100%;
    }
}

/* Print */
@media print {
    .jettaprint-steps,
    .jettaprint-actions,
    .jettaprint-price-preview {
        display: none;
    }
}

/* v5.3 - Acabamentos desabilitados */
label.acabamento-disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
}

label.acabamento-disabled input[type="checkbox"] {
    cursor: not-allowed !important;
}

label.acabamento-disabled:hover {
    background: #f9f9f9 !important;
}

/* ============================================================
   Prazo de Entrega Banner — v5.7
   ============================================================ */

.jp-prazo-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 6px;
    margin: 12px 0 4px;
    font-size: 14px;
    transition: background .25s, border-color .25s;
    border: 1px solid transparent;
}

.jp-prazo-banner.jp-prazo-vazio {
    background: #f6f7f7;
    border-color: #e0e0e0;
    color: #646970;
    font-style: italic;
}

.jp-prazo-banner.jp-prazo-ativo {
    background: #e8f4fd;
    border-color: #2271b1;
    color: #1d2327;
}

.jp-prazo-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.jp-prazo-texto {
    flex: 1;
    line-height: 1.5;
}

/* Prazo no resumo */
#summary-prazo-section .summary-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

/* ============================================================
   Encadernação — nota fixa e aviso dinâmico de ficheiros v5.8
   ============================================================ */

.enc-nota-fixa {
    font-size: 11px;
    color: #646970;
    background: #f6f7f7;
    border-left: 3px solid #c3c4c7;
    padding: 5px 8px;
    margin: 4px 0 6px;
    border-radius: 0 3px 3px 0;
    line-height: 1.4;
}

.enc-ficheiros-aviso {
    margin-top: 6px;
}

/* ===================== */
/* v6.3.2 - DRAFT SYSTEM STYLES */
/* ===================== */

/* Draft notification */
.jettaprint-draft-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--jp-success);
    color: white;
    padding: 12px 20px;
    border-radius: var(--jp-radius);
    box-shadow: var(--jp-shadow);
    z-index: 1000;
    font-size: 14px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Draft banner */
.jettaprint-draft-banner {
    background: var(--jp-bg-light);
    border: 1px solid var(--jp-warning);
    border-left: 4px solid var(--jp-warning);
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: var(--jp-radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.jettaprint-draft-banner .draft-icon {
    font-size: 24px;
}

.jettaprint-draft-banner button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.jettaprint-draft-banner .btn-restore-draft {
    background: var(--jp-success);
    color: white;
}

.jettaprint-draft-banner .btn-restore-draft:hover {
    background: var(--jp-primary-hover);
}

.jettaprint-draft-banner .btn-clear-draft {
    background: transparent;
    color: var(--jp-text-light);
    border: 1px solid var(--jp-border);
}

.jettaprint-draft-banner .btn-clear-draft:hover {
    background: var(--jp-bg-light);
    color: var(--jp-text);
}

/* Draft buttons in header */
.jettaprint-draft-controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-draft-action {
    padding: 8px 16px;
    background: var(--jp-bg-light);
    border: 1px solid var(--jp-border);
    border-radius: var(--jp-radius);
    cursor: pointer;
    font-size: 13px;
    color: #1d2327;
    transition: all 0.2s;
}

.btn-draft-action:hover {
    background: var(--jp-primary);
    color: white;
    border-color: var(--jp-primary);
}

/* v6.3.2 - Checkmark for completed steps */
.step-checkmark {
    position: absolute;
    top: 0;
    right: -8px;
    width: 16px;
    height: 16px;
    background: var(--jp-success);
    color: white;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.jettaprint-step.completed .step-checkmark {
    display: flex;
}

