/* ===== RESET E VARIÁVEIS ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2196F3;
    --secondary-color: #4CAF50;
    --danger-color: #f44336;
    --warning-color: #ff9800;
    --success-color: #4CAF50;
    --light-gray: #f5f5f5;
    --medium-gray: #e0e0e0;
    --dark-gray: #333;
    --border-radius: 8px;
    --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* ===== BODY E CONTAINER ===== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--dark-gray);
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* ===== HEADER ===== */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1976D2 100%);
    color: white;
    padding: 40px 20px;
    text-align: center;
    box-shadow: var(--box-shadow);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

header .subtitle {
    font-size: 1.1em;
    opacity: 0.9;
    font-weight: 300;
}

/* ===== FORM SECTIONS ===== */
.form-section {
    padding: 30px;
    border-bottom: 1px solid var(--medium-gray);
    display: none;
}

.form-section.active {
    display: block;
    animation: slideIn 0.3s ease;
}

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

.form-section h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.8em;
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 10px;
}

.form-section h3 {
    color: var(--dark-gray);
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 1.3em;
    border-left: 4px solid var(--secondary-color);
    padding-left: 15px;
}

.form-section h4 {
    color: var(--dark-gray);
    margin-top: 20px;
    margin-bottom: 15px;
    font-size: 1.1em;
}

/* ===== FORM GROUPS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-gray);
    font-size: 0.95em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--medium-gray);
    border-radius: var(--border-radius);
    font-size: 1em;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.form-group input[readonly] {
    background-color: var(--light-gray);
    cursor: not-allowed;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.obrigatorio {
    color: var(--danger-color);
    font-weight: bold;
}

.help-text {
    display: block;
    margin-top: 5px;
    font-size: 0.85em;
    color: #666;
    font-style: italic;
}

/* ===== FORM ROWS ===== */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-row.flex-2-1 {
    grid-template-columns: 2fr 1fr;
}

.form-row.flex-1-1 {
    grid-template-columns: 1fr 1fr;
}

.form-group.flex-2 {
    grid-column: 2;
}

.form-group.flex-1 {
    grid-column: 1;
}

/* ===== INPUT WITH BUTTON ===== */
.input-with-button {
    display: flex;
    gap: 10px;
}

.input-with-button input {
    flex: 1;
}

.input-with-button button {
    flex: 0 0 auto;
    min-width: 120px;
}

/* ===== BOTÕES ===== */
button {
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 0.95em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1976D2 100%);
    color: white;
    padding: 14px 30px;
    width: 100%;
    margin-top: 20px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(33, 150, 243, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
    padding: 12px 20px;
}

.btn-secondary:hover {
    background: #45a049;
    transform: translateY(-2px);
}

.btn-add {
    background: var(--secondary-color);
    color: white;
    padding: 12px 20px;
    width: 100%;
    margin-top: 15px;
}

.btn-add:hover {
    background: #45a049;
}

.btn-add-file {
    background: var(--warning-color);
    color: white;
    padding: 10px 15px;
    margin-top: 10px;
    font-size: 0.9em;
}

.btn-add-file:hover {
    background: #e68900;
}

.btn-remove {
    background: var(--danger-color);
    color: white;
    padding: 5px 10px;
    font-size: 0.85em;
    margin-left: 10px;
}

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

/* ===== FEEDBACK E MENSAGENS ===== */
.feedback {
    margin-top: 10px;
    padding: 12px 15px;
    border-radius: var(--border-radius);
    font-size: 0.95em;
    display: none;
}

.feedback.show {
    display: block;
}

.feedback.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.feedback.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.feedback.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.feedback.warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* ===== MESSAGE BOX ===== */
.message-box {
    margin-top: 30px;
    padding: 20px;
    border-radius: var(--border-radius);
    display: none;
    animation: slideIn 0.3s ease;
}

.message-box.show {
    display: block;
}

.message-box.success {
    background-color: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
}

.message-box.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 2px solid #dc3545;
}

.message-box h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.message-box ul {
    margin-left: 20px;
}

.message-box li {
    margin-bottom: 8px;
}

/* ===== FILE LIST ===== */
.file-list {
    list-style: none;
    margin-top: 10px;
}

.file-list li {
    background: var(--light-gray);
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: var(--border-radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--primary-color);
}

.file-list li span {
    flex: 1;
}

.file-list li button {
    flex: 0 0 auto;
}

/* ===== INFO BOX ===== */
.info-box {
    background: #e3f2fd;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
}

.info-box h3 {
    color: var(--primary-color);
    margin-top: 0;
}

/* ===== CONTRATO ITEM ===== */
.contrato-item {
    background: var(--light-gray);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border-left: 4px solid var(--secondary-color);
    position: relative;
}

.contrato-item h4 {
    margin-top: 0;
    color: var(--secondary-color);
}

.contrato-item .btn-remove {
    position: absolute;
    top: 15px;
    right: 15px;
}

/* ===== FORM ACTIONS ===== */
.form-actions {
    padding: 30px;
    background: var(--light-gray);
    display: flex;
    gap: 15px;
    justify-content: center;
}

.form-actions button {
    min-width: 150px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .container {
        border-radius: 0;
    }

    header h1 {
        font-size: 1.8em;
    }

    .form-section {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-row.flex-2-1 {
        grid-template-columns: 1fr;
    }

    .input-with-button {
        flex-direction: column;
    }

    .input-with-button button {
        width: 100%;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions button {
        width: 100%;
    }

    body {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5em;
    }

    .form-section {
        padding: 15px;
    }

    .form-section h2 {
        font-size: 1.4em;
    }

    .form-group label {
        font-size: 0.9em;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Previne zoom no iOS */
    }
}

/* ===== LOADING STATE ===== */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    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;
}

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

/* ===== PRINT STYLES ===== */
@media print {
    body {
        background: white;
    }

    .container {
        box-shadow: none;
        border-radius: 0;
    }

    button,
    .form-actions {
        display: none;
    }
}

/* Lista de arquivos */
.file-list {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.file-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin: 5px 0;
    background: #f5f5f5;
    border-radius: 4px;
    border-left: 3px solid var(--primary-color);
}

.file-name {
    flex: 1;
    font-weight: 500;
    color: #333;
}

.file-size {
    color: #666;
    font-size: 0.9em;
    margin: 0 10px;
}

.btn-remove-file {
    background: #dc3545;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    transition: background 0.2s;
}

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