/**
 * ErgonTech - Estilos do formulário
 * Estilo: Barras coloridas, layout flat (referência segundo print)
 */

:root {
    --primary: #00CCCC;
    --secondary: #2E3E46;
    --green-light: #7cb342;
    --green-dark: #2e7d32;
    --blue-dark: #1565c0;
    --orange: #795548;
    --teal-gray: #37474f;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #2E3E46;
    --light: #f5f5f5;
    --border: #e0e0e0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #e8eef2;
    min-height: 100vh;
    color: var(--dark);
    line-height: 1.6;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Progress Bar */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(0, 0, 0, 0.08);
    z-index: 1000;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    transition: width 0.5s ease;
}

.progress-text {
    position: absolute;
    right: 1rem;
    top: -2rem;
    font-size: 0.75rem;
    color: var(--dark);
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.theme-toggle:hover {
    transform: scale(1.05);
}

.theme-toggle i {
    color: var(--secondary);
    font-size: 1.2rem;
}

/* Form Header */
.form-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, #0099A3 100%);
    border-radius: 8px;
    color: white;
}

.form-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
}

.form-header p {
    opacity: 0.95;
    margin-top: 0.25rem;
    font-size: 0.9rem;
}

/* Form Alerts */
.form-alert {
    padding: 1rem 1.25rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.form-alert-error {
    background: #ffebee;
    border: 1px solid #ef4444;
    color: #b71c1c;
}

.form-alert-success {
    background: #e8f5e9;
    border: 1px solid #10b981;
    color: #1b5e20;
}

.btn-setup {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: #ef4444;
    color: white !important;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
}

.btn-setup:hover {
    background: #dc2626;
}

/* Section Cards - Barras coloridas */
.form-section {
    background: white;
    border-radius: 6px;
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.form-section .section-bar {
    padding: 0.6rem 1rem;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section .section-bar.green-light { background: var(--green-light); }
.form-section .section-bar.green-dark { background: var(--green-dark); }
.form-section .section-bar.blue { background: var(--blue-dark); }
.form-section .section-bar.orange { background: var(--orange); }
.form-section .section-bar.teal { background: var(--teal-gray); }

.form-section .section-content {
    padding: 1.25rem;
}

.form-section .section-bar .section-letter {
    font-weight: 700;
    margin-right: 0.25rem;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
.full-width { grid-column: 1 / -1; }

@media (max-width: 768px) {
    .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
}

/* Input Groups - Estilo flat */
.input-group {
    position: relative;
}

.input-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    font-size: 0.85rem;
    color: #374151;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: white;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.input-group input.error,
.input-group select.error,
.input-group textarea.error {
    border-color: var(--danger);
}

.input-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Radio - estilo simplificado */
.radio-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.radio-card {
    position: relative;
    cursor: pointer;
}

.radio-card input {
    position: absolute;
    opacity: 0;
}

.radio-card-content {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    background: white;
    border: 1px solid var(--border);
    transition: all 0.2s;
    text-align: center;
    font-size: 0.9rem;
}

.radio-card:hover .radio-card-content {
    border-color: #9ca3af;
}

.radio-card input:checked + .radio-card-content {
    border-color: var(--primary);
    background: #f0fdfa;
    box-shadow: 0 0 0 2px rgba(0, 204, 204, 0.3);
}

.radio-card-content i {
    font-size: 1.25rem;
    color: var(--primary);
    margin-right: 0.5rem;
}

/* Checkbox - estilo flat com labels */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.5rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
}

.checkbox-item input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.checkbox-item span {
    font-size: 0.9rem;
    cursor: pointer;
}

/* Checkbox card (manter para sistemas) */
.checkbox-card .checkbox-card-content {
    padding: 0.6rem 0.75rem;
    border-radius: 4px;
    background: white;
    border: 1px solid var(--border);
}

.checkbox-card input:checked + .checkbox-card-content {
    border-color: var(--primary);
    background: #f0fdfa;
}

/* Subsection */
.subsection {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.subsection h3 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    color: var(--dark);
}

/* TEF Grid - 2 colunas conforme layout de referência */
.tef-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.tef-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (max-width: 768px) {
    .tef-grid {
        grid-template-columns: 1fr;
    }
}

/* Service Block */
.service-block {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

@media (max-width: 480px) {
    .service-block { grid-template-columns: 1fr; }
}

/* Buttons */
.btn {
    padding: 0.6rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--blue-dark);
    color: white;
}

.btn-primary:hover {
    background: #0d47a1;
}

.btn-success {
    background: var(--green-dark);
    color: white;
}

.btn-success:hover {
    background: #1b5e20;
}

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.btn-secondary:hover {
    background: #d1d5db;
}

.cnpj-search-btn {
    margin-top: 0.5rem;
}

/* Floating Actions */
.floating-actions {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 998;
}

.fab {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.fab-save { background: var(--warning); }
.fab-submit { background: var(--blue-dark); }

/* Footer buttons */
.form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 1rem;
    background: white;
    border-radius: 6px;
    margin-top: 1rem;
}

/* Section collapse (opcional) */
.section-header {
    cursor: pointer;
    user-select: none;
}

.section-header .chevron {
    transition: transform 0.2s;
}

.section-header.collapsed .chevron {
    transform: rotate(-90deg);
}

/* Validation */
.error-message {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 0.2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container { padding: 1rem; }
    .form-header h1 { font-size: 1.4rem; }
    .floating-actions { bottom: 1rem; right: 1rem; }
}
