:root {
    --maxpool-primary: #04658c;
    --maxpool-secondary: #6c757d;
    --maxpool-success: #28a745;
    --maxpool-info: #17a2b8;
    --maxpool-warning: #ffc107;
    --maxpool-danger: #dc3545;
    --maxpool-light: #f8f9fa;
    --maxpool-dark: #343a40;
    --maxpool-gradient: linear-gradient(135deg, #04658c 0%, #033d5c 100%);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #2c3e50;
}

.main-container {
    background: white;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    overflow: hidden;
    margin: 2rem auto;
    max-width: 1200px;
}

.header-section {
    background: var(--maxpool-gradient);
    color: white;
    padding: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.3;
}

.logo-section {
    position: relative;
    z-index: 2;
}

.logo-placeholder {
    width: 100px;
    height: 60px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.form-section {
    padding: 2.5rem;
}

.section-title-ficha {
    background: var(--maxpool-gradient);
    color: white;
    padding: 0.8rem 1.5rem;
    margin: 0 -2.5rem 2rem -2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.section-title-ficha::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    font-weight: 600;
    color: var(--maxpool-dark);
    margin-bottom: 0.5rem;
    display: block;
    font-size: 0.9rem;
}

.form-control,
.form-select {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: #fff;
}

.form-control:focus,
.form-select:focus {
    border-color: #04658c;
    box-shadow: 0 0 0 0.2rem rgba(4, 101, 140, 0.15);
    transform: translateY(-2px);
}

.form-control.is-invalid {
    border-color: var(--maxpool-danger);
    background-image: none;
}

.form-control.is-valid {
    border-color: var(--maxpool-success);
    background-image: none;
}

.invalid-feedback,
.valid-feedback {
    font-size: 0.8rem;
    margin-top: 0.3rem;
}

.btn-primary {
    background: var(--maxpool-gradient);
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(4, 101, 140, 0.3);
}

.btn-secondary {
    background: #6c757d;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(108, 117, 125, 0.3);
}

.client-type-section {
    background: rgba(4, 101, 140, 0.05);
    padding: 1.5rem;
    border-radius: 15px;
    border: 2px solid rgba(4, 101, 140, 0.1);
    margin-bottom: 2rem;
}

.form-check {
    margin-bottom: 1rem;
}

.form-check-input {
    border-radius: 50%;
    border: 2px solid #dee2e6;
    width: 1.2em;
    height: 1.2em;
}

.form-check-input:checked {
    background-color: #04658c;
    border-color: #04658c;
}

.form-check-label {
    font-weight: 500;
    margin-left: 0.5rem;
}

/* Grid Responsivo para substituir tabelas */
.grid-container {
    display: grid;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 1rem;
}

.grid-header {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    background: var(--maxpool-gradient);
    color: white;
    font-weight: 600;
    padding: 1rem;
    gap: 0.5rem;
}

.grid-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    padding: 0.5rem 1rem;
    gap: 0.5rem;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
}

.grid-row:last-child {
    border-bottom: none;
}

.grid-cell {
    padding: 0.5rem;
}

.grid-cell .form-control {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    width: 100%;
}

.add-row-btn {
    background: rgba(40, 167, 69, 0.1);
    border: 2px solid var(--maxpool-success);
    color: var(--maxpool-success);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-bottom: 2rem;
}

.add-row-btn:hover {
    background: var(--maxpool-success);
    color: white;
    transform: translateY(-2px);
}

.remove-row-btn {
    background: rgba(220, 53, 69, 0.1);
    border: none;
    color: var(--maxpool-danger);
    padding: 0.3rem 0.7rem;
    border-radius: 15px;
    font-size: 0.7rem;
    transition: all 0.3s ease;
}

.remove-row-btn:hover {
    background: var(--maxpool-danger);
    color: white;
}

.instructions-section {
    background: rgba(23, 162, 184, 0.05);
    border: 2px solid rgba(23, 162, 184, 0.2);
    border-radius: 15px;
    padding: 2rem;
    margin-top: 2rem;
}

.instructions-section h5 {
    color: var(--maxpool-info);
    font-weight: 600;
    margin-bottom: 1rem;
}

.instructions-section p {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

.loading-spinner {
    display: none;
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Animações para mensagens */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.error-container {
    animation: slideDown 0.3s ease-out;
}

.error-container.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

/* Estilos melhorados para mensagens de erro */
.alert {
    border: none;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    font-weight: 500;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.alert-danger {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    color: #c62828;
    border-left: 4px solid #f44336;
}

.alert-success {
    background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%);
    color: #2e7d32;
    border-left: 4px solid #4caf50;
}

.alert i {
    font-size: 1.1em;
}

/* Container centralizado para mensagens */
.text-center .alert {
    display: inline-block;
    text-align: left;
}

/* Estilos para o CEP */
.loading {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2304658c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

/* Badge de informação */
.badge {
    cursor: pointer;
    font-size: 0.7em;
}

/* Mensagens do CEP */
#cep-message {
    animation: slideDown 0.3s ease-out;
    font-size: 0.85rem;
}

/* Tooltip customizado */
.tooltip {
    font-size: 0.8rem;
}

/* Responsividade para dispositivos móveis */
@media (max-width: 768px) {
    .main-container {
        margin: 0;
        border-radius: 0;
    }
    
    .form-section {
        padding: 1.5rem;
    }
    
    .section-title-ficha {
        margin: 0 -1.5rem 1.5rem -1.5rem;
        padding: 0.8rem 1rem;
    }
    
    .grid-header,
    .grid-row {
        grid-template-columns: 1fr;
        padding: 0.75rem;
    }
    
    .grid-header {
        display: none;
    }
    
    .grid-cell {
        display: flex;
        flex-direction: column;
        padding: 0.5rem 0;
    }
    
    .grid-cell::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
        color: var(--maxpool-primary);
    }
    
    .client-type-section {
        padding: 1rem;
    }
    
    .instructions-section {
        padding: 1.5rem;
    }
}

@media (max-width: 576px) {
    .header-section {
        padding: 1.5rem;
    }
    
    .form-section {
        padding: 1rem;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 0.75rem 1.5rem;
        font-size: 0.8rem;
    }
}