/* Reset e base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    margin-bottom: 40px;
    color: white;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.logo-section {
    flex-shrink: 0;
}

.logo-section .logo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.title-section {
    text-align: left;
}

.title-section h1 {
    font-size: 3rem;
    margin: 0 0 4px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    line-height: 1.1;
}

.title-section p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin: 0;
}

/* Main content */
main {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 40px;
}

/* Main layout */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 30px;
}

.controls-section {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.upload-preview-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Upload section */
.upload-section {
    margin-bottom: 30px;
}

/* File upload styling for new layout */
.file-upload {
    position: relative;
    margin-bottom: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.file-upload input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-label {
    display: block;
    padding: 20px 15px;
    border: 3px dashed #ddd;
    border-radius: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.file-label:hover {
    border-color: #667eea;
    background: #f0f2ff;
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: #667eea;
}

.file-label span {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.file-label small {
    color: #666;
    font-size: 0.85rem;
}

/* Preview */
.preview-container {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
}

.preview-container-right {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    width: 100%;
    height: fit-content;
    display: flex;
    flex-direction: column;
}

.preview-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.preview-image-container {
    position: relative;
    display: inline-block;
}

.preview-container img,
.preview-container-right img {
    max-width: 100%;
    max-height: 300px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    display: block;
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.preview-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

/* Preview Statistics */
.preview-stats {
    margin-top: 10px;
    padding: 8px;
    background: linear-gradient(135deg, #f8f9ff 0%, #e8ecff 100%);
    border-radius: 8px;
    border: 1px solid #e0e4ff;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.stat-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 6px 8px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    gap: 8px;
}

.stat-item [data-lucide] {
    width: 20px;
    height: 20px;
    color: #667eea;
    flex-shrink: 0;
}

.stat-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: #666;
    font-weight: 500;
    margin-bottom: 0;
    line-height: 1;
}

.stat-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    line-height: 1;
}

.btn-remove {
    background: #dc3545;
}

.btn-remove:hover {
    background: #c82333;
}

/* Botões na seção de preview */
.btn-change,
.btn-process {
    background: #667eea;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-change [data-lucide],
.btn-process [data-lucide] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-change:hover,
.btn-process:hover {
    background: #5a67d8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-process:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-change {
    background: #6c757d;
}

.btn-change:hover {
    background: #5a6268;
}

/* Orientation Selector - Simplified */
.orientation-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.orientation-selector input[type="radio"] {
    display: none;
}

.orientation-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    text-align: center;
}

.orientation-option:hover {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateY(-1px);
}

.orientation-selector input[type="radio"]:checked + .orientation-option {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea10 0%, #764ba210 100%);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.2);
}

.option-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.option-text strong {
    font-size: 0.9rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 6px;
}

.option-text small {
    font-size: 0.75rem;
    color: #666;
    font-weight: normal;
}

/* Options Layout */
.options-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.options-left {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.options-right {
    display: flex;
    align-items: flex-start;
}

/* Option groups styling */
.option-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-group label {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-group input[type="number"] {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.option-group input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.option-group small {
    color: #666;
    font-size: 0.85rem;
    margin-top: 5px;
}

/* Explanation highlight for better visibility */
.explanation-highlight {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border: 1px solid #2196f3;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #1976d2;
    font-weight: 500;
    animation: fadeIn 0.3s ease-in;
}

.explanation-highlight i {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #2196f3;
}

.explanation-highlight span {
    line-height: 1.4;
}

/* Preview Dimensions */
.preview-dimensions {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 20px;
    width: 100%;
}

.preview-dimensions h4 {
    margin-bottom: 15px;
    color: #495057;
    font-size: 1.1rem;
    text-align: center;
}

.dimension-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dimension-info p {
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #dee2e6;
}

.dimension-info p:last-child {
    border-bottom: none;
    font-weight: 600;
    color: #667eea;
}

.dimension-info strong {
    color: #495057;
}

.dimension-info span {
    color: #667eea;
    font-weight: 600;
}

/* Options Grid (mantendo para compatibilidade) */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.option-group {
    display: flex;
    flex-direction: column;
}

.option-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 1.1rem;
}

.option-group select,
.option-group input {
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background: white;
}

.option-group select:focus,
.option-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.option-group small {
    margin-top: 5px;
    color: #666;
    font-size: 0.85rem;
}

/* Buttons */
.btn-process {
    width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-process [data-lucide] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn-process:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.btn-process:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-secondary [data-lucide] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Results section */
.results-section {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, #d4e157 0%, #689f38 100%);
    border-radius: 15px;
    color: white;
}

.results-section h2 {
    margin-bottom: 20px;
    font-size: 2rem;
}

.result-info {
    margin-bottom: 25px;
}

.result-info p {
    font-size: 1.1rem;
    margin-bottom: 10px;
}



/* Download actions */
.download-actions {
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.btn-download-pdf {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 160px;
}

.btn-download-pdf:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.btn-download-pdf:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-download-pdf [data-lucide] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn-download-pdf:disabled [data-lucide="loader"] {
    animation: spin 1s linear infinite;
}



/* Loading */
.loading {
    text-align: center;
    padding: 40px;
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    font-size: 1.2rem;
    color: #666;
}

.loading small {
    color: #888;
    font-size: 0.9rem;
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    margin: 15px 0 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

/* Footer */
footer {
    color: white;
}

.info-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.info-card {
    background: rgba(255,255,255,0.1);
    padding: 25px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.info-card h3 {
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.info-card ol,
.info-card ul {
    padding-left: 20px;
}

.info-card li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* Preview de dimensões */
#dimensionsPreview {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border: 2px solid #2196f3;
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    font-family: 'Segoe UI', monospace;
    font-size: 1rem;
    white-space: pre-line;
    color: #1976d2;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.15);
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Technical summary */
.technical-summary {
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.9);
    border-left: 4px solid rgba(255,255,255,0.5);
}

.technical-summary h4 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: white;
}

.technical-summary .tech-row {
    display: flex;
    justify-content: space-between;
    margin: 5px 0;
    padding: 2px 0;
}

.technical-summary .tech-label {
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header-content {
        gap: 20px;
    }
    
    .logo-section .logo {
        width: 80px;
        height: 80px;
    }
    
    .title-section h1 {
        font-size: 2.5rem;
    }
    
    main {
        padding: 25px;
    }
    
    .main-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .controls-section {
        order: 2;
    }
    
    .upload-preview-section {
        order: 1;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .info-cards {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .download-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-download-pdf {
        width: 100%;
        justify-content: center;
    }
    
    .options-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .orientation-selector {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .title-section {
        text-align: center;
    }
    
    .title-section h1 {
        font-size: 2rem;
    }
    
    .title-section p {
        font-size: 1rem;
    }
    
    .logo-section .logo {
        width: 70px;
        height: 70px;
    }
    
    main {
        padding: 20px;
    }
    
    .file-label {
        padding: 25px 15px;
        min-height: 200px;
    }
    
    .orientation-option {
        padding: 12px 8px;
    }
    
    .option-text strong {
        font-size: 0.8rem;
    }
    
    .option-text small {
        font-size: 0.7rem;
    }
    
    .preview-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-change,
    .btn-process {
        width: 100%;
        justify-content: center;
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    .btn-download-pdf {
        padding: 12px 20px;
        font-size: 1rem;
        min-width: 140px;
    }
    
    .btn-secondary {
        padding: 12px 20px;
        font-size: 1rem;
    }
}
