:root {
    --bg-base: #0b0f19;
    --bg-surface: #151c2c;
    --bg-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #10b981;
    --accent-warning: #f59e0b;
    --accent-error: #ef4444;
    --border-color: #334155;
    --border-focus: #60a5fa;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.5;
    padding: 2rem;
    min-height: 100vh;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

.app-container {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
}

.logo-area {
    display: flex;
    align-items: center;
}

.brand-logo {
    height: 100px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
    transition: transform 0.2s ease;
}

.brand-logo:hover {
    transform: scale(1.02);
}

.header-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--border-focus);
    flex-shrink: 0;
}

.badge-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.6; }
}

/* Routing Views */
.view-section {
    display: none;
    width: 100%;
}

.view-section.active {
    display: block;
    animation: slideIn 0.3s ease-in-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hero Section */
.hero-section {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 3rem auto;
    width: 100%;
}

.hero-section h2 {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-section p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Config Banner */
.config-instructions-card {
    background-color: rgba(245, 158, 11, 0.08);
    border: 1px dashed var(--accent-warning);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    line-height: 1.5;
}

.config-instructions-card h4 {
    font-family: var(--font-heading);
    color: #fde047;
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.config-instructions-card code {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    color: #ff9f43;
    font-family: monospace;
}

/* Premium Form Styling */
.form-container-wrapper {
    width: 100%;
}

.premium-form {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
}

.form-section-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.25rem;
    position: relative;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    width: 100%;
}

.section-badge {
    position: absolute;
    top: -12px;
    left: 24px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--border-focus);
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.25rem 0.75rem;
    border-radius: 30px;
}

.form-section-card .section-title {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--border-focus);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.form-row {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 1rem;
    width: 100%;
}

.form-row:last-child {
    margin-bottom: 0;
}

.two-cols {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0; /* Prevents overflow in flex children */
}

label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

input, select, textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: #fff;
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='%2394a3b8' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 24px;
    padding-right: 2.5rem !important;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

.conditional-section {
    transition: all 0.3s ease;
    max-height: 700px;
    opacity: 1;
    overflow: hidden;
    width: 100%;
}

.conditional-section.hidden {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
    pointer-events: none;
}

/* Modality fields show/hide */
.modality-fields {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
}

.modality-fields.hidden {
    display: none;
}

.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-3 { margin-bottom: 1rem; }

/* Document Upload Zone */
.document-upload-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.5rem;
    width: 100%;
}

.upload-box-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.upload-area {
    border: 2px dashed var(--border-color);
    background-color: rgba(21, 28, 44, 0.5);
    border-radius: 12px;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.upload-area:hover, .upload-area.highlight {
    border-color: var(--border-focus);
    background-color: rgba(96, 165, 250, 0.05);
}

.upload-icon {
    width: 32px;
    height: 32px;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.upload-area:hover .upload-icon {
    color: var(--border-focus);
}

.upload-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.upload-format {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Multi-upload Previews List */
.file-preview-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
    width: 100%;
}

/* Upload Preview */
.file-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    animation: fadeIn 0.2s ease-in-out;
    width: 100%;
}

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

.file-name {
    color: var(--accent);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
}

.remove-file-btn {
    background: none;
    border: none;
    color: var(--accent-error);
    font-size: 1.25rem;
    cursor: pointer;
    font-weight: 700;
    line-height: 1;
}

.remove-file-btn:hover {
    color: #fca3a3;
}

/* Info Box / Notes */
.alert-box-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background-color: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 10px;
    color: #93c5fd;
    font-size: 0.9rem;
    width: 100%;
}

.alert-box-info.hidden {
    display: none;
}

/* Button & Spinner */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    border: none;
    border-radius: 10px;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.form-submit-btn {
    align-self: center;
    min-width: 250px;
}

.btn-secondary {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background-color: var(--border-color);
    border-color: var(--text-muted);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

.spinner.hidden {
    display: none;
}

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

/* Success Card */
.success-card {
    max-width: 600px;
    margin: 4rem auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    width: 100%;
}

.success-icon-wrapper {
    width: 72px;
    height: 72px;
    background-color: rgba(16, 185, 129, 0.1);
    border: 2px solid var(--accent);
    color: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.success-icon-wrapper svg {
    width: 36px;
    height: 36px;
}

.success-card h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

.success-card p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.success-details {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 8px;
    width: 100%;
    margin-bottom: 1.5rem;
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Responsividade Mobile Adicional */
@media (max-width: 768px) {
    .two-cols {
        grid-template-columns: minmax(0, 1fr);
    }
    
    .document-upload-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 1rem;
    }
    
    .app-header {
        flex-direction: column;
        gap: 1.25rem;
        align-items: center;
        text-align: center;
        margin-bottom: 1.5rem;
        padding-bottom: 1.25rem;
    }
    
    .brand-logo {
        height: 75px;
    }
    
    .form-section-card {
        padding: 1.75rem 1.25rem;
    }
    
    .hero-section h2 {
        font-size: 1.75rem;
    }
    
    .hero-section {
        margin-bottom: 2rem;
    }
    
    .header-badge {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}
