* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.header {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.header h1 {
    color: #333;
    margin-bottom: 10px;
}

.header p {
    color: #666;
}

.btn-cadastro {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: transform 0.2s;
    display: inline-block;
}

.btn-cadastro:hover {
    transform: translateY(-2px);
}

.btn-voltar {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* Cards */
.card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.card h2 {
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.card h3 {
    color: #555;
    margin-bottom: 10px;
    font-size: 18px;
}

/* Status Bar */
.status-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    padding: 10px;
}

.status-item {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.status-label {
    font-weight: 600;
    color: #555;
    display: block;
    margin-bottom: 5px;
}

.status-value {
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
}

/* Cadastro Rápido */
.cadastro-rapido {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.cadastro-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.cadastro-item .form-group {
    display: flex;
    gap: 10px;
    margin-bottom: 0;
}

.cadastro-item input {
    flex: 1;
}

/* Radio Buttons */
.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s;
    background: white;
}

.radio-label:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.radio-label input[type="radio"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.radio-label input[type="radio"]:checked+span {
    color: #667eea;
    font-weight: 600;
}

.radio-label:has(input[type="radio"]:checked) {
    border-color: #667eea;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
}

/* Formulário */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

input, select, textarea {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #667eea;
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: transform 0.2s;
}

button:hover {
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.btn-small {
    padding: 8px 20px;
    font-size: 14px;
    white-space: nowrap;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    flex-wrap: wrap;
}

.tab-btn {
    background: none;
    color: #666;
    padding: 10px 20px;
    border-radius: 8px 8px 0 0;
    margin-bottom: -2px;
}

.tab-btn:hover {
    transform: none;
    background: #f0f0f0;
}

.tab-btn.active {
    background: #667eea;
    color: white;
}

/* Lista de Dados */
.lista-dados {
    max-height: 400px;
    overflow-y: auto;
}

.dados-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.2s;
    animation: fadeIn 0.3s ease;
}

.dados-item:hover {
    background: #f8f9fa;
}

.dados-info {
    flex: 1;
}

.dados-nome {
    font-weight: 600;
    color: #333;
}

.dados-id {
    font-size: 12px;
    color: #999;
    margin-left: 10px;
}

.dados-detalhes {
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

.dados-acoes {
    display: flex;
    gap: 10px;
}

.btn-remover {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    padding: 5px 12px;
    font-size: 12px;
}

/* Tabelas */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

th {
    background: #f8f9fa;
    color: #333;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

th:hover {
    background: #e9ecef;
}

tr:hover {
    background: #f8f9fa;
}

.status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.status-pendente {
    background: #fff3cd;
    color: #856404;
}

.status-andamento {
    background: #cce5ff;
    color: #004085;
}

.status-concluido {
    background: #d4edda;
    color: #155724;
}

/* Resultados */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.result-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    border-left: 4px solid;
    transition: all 0.3s ease;
}

.result-card h3 {
    margin-bottom: 15px;
    color: #333;
}

.result-card.segurado {
    border-left-color: #4caf50;
}

.result-card.cia {
    border-left-color: #2196f3;
}

.result-card.corretora {
    border-left-color: #ff9800;
}

.result-card.geral {
    border-left-color: #9c27b0;
}

.procedure-item {
    background: white;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.procedure-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 10px;
}

.procedure-title {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.procedure-date {
    font-size: 11px;
    color: #999;
}

.procedure-details {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
}

.procedure-category {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    background: #f3e5f5;
    color: #7b1fa2;
    margin-bottom: 5px;
}

.procedure-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    margin-bottom: 5px;
}

.type-segurado {
    background: #e8f5e9;
    color: #2e7d32;
}

.type-cia {
    background: #e3f2fd;
    color: #1565c0;
}

.type-corretora {
    background: #fff3e0;
    color: #ef6c00;
}

.type-geral {
    background: #f3e5f5;
    color: #7b1fa2;
}

.no-data {
    color: #999;
    text-align: center;
    padding: 20px;
}

/* Mensagens */
.message, .status-message {
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.message.success, .status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.message.error, .status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.message.info, .status-message.info {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
    display: block;
}

/* Ações */
.actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Controles da Tabela */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 15px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    max-width: 300px;
}

.search-box input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

/* Paginação */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.pagination button {
    padding: 8px 16px;
    font-size: 14px;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#paginaInfo {
    font-size: 14px;
    color: #666;
}

/* Resumo da Consulta */
.resumo-consulta {
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
}

.resumo-consulta h3 {
    margin-bottom: 15px;
    color: #333;
}

.resumo-itens {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.resumo-item {
    text-align: center;
    padding: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.resumo-label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.resumo-valor {
    display: block;
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

/* Loading Overlay */
#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.loading-content {
    text-align: center;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Animações */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Validação de erro */
.validation-error {
    border-color: #f5576c !important;
    background-color: #fff5f5 !important;
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Mensagem de orientação */
.mensagem-orientacao {
    background: #e3f2fd;
    padding: 10px;
    border-radius: 8px;
    margin: 10px 0;
    color: #1565c0;
    font-size: 14px;
    animation: fadeInOut 3s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-10px); }
    10% { opacity: 1; transform: translateY(0); }
    90% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}

/* Info Text */
.info-text {
    background: #e3f2fd;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    color: #1565c0;
    font-size: 14px;
}

/* Checkbox no label */
.form-group label input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    vertical-align: middle;
}

.form-group label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

select:disabled {
    opacity: 0.6;
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* Responsividade */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .cadastro-rapido {
        grid-template-columns: 1fr;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .resumo-itens {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .table-controls {
        flex-direction: column;
    }
    
    .search-box {
        max-width: 100%;
    }
    
    .pagination {
        flex-wrap: wrap;
    }
    
    .status-message {
        left: 20px;
        right: 20px;
        min-width: auto;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .actions button {
        width: 100%;
    }
    
    .radio-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .radio-label {
        width: 100%;
    }
}

/* Botão de Edição */
.btn-edit {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: transform 0.2s;
    margin-right: 5px;
}

.btn-edit:hover {
    transform: translateY(-2px);
}

.btn-edit:active {
    transform: translateY(0);
}

/* Loading Info */
.loading-info {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    color: #1565c0;
    margin-bottom: 20px;
    display: none;
}

/* Ações do formulário */
.actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    flex: 1;
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    flex: 1;
}