/* assets/style.css */
* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: #f4f6f9;
    margin: 0;
    padding: 15px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

h1 {
    color: #1a5490;
    border-bottom: 3px solid #1a5490;
    padding-bottom: 10px;
    font-size: 1.5rem;
}

h2 {
    color: #2c3e50;
    font-size: 1.2rem;
    margin-top: 20px;
}

/* Sección de búsqueda */
.search-section {
    background: #eef5fc;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.search-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

input, select, textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #1a5490;
    box-shadow: 0 0 0 2px rgba(26,84,144,0.1);
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 13px;
    color: #555;
}

.form-group {
    margin-bottom: 15px;
}

/* Grid de campos de dignatarios */
.dignatarios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.dignatario-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #1a5490;
}

.dignatario-card h3 {
    margin: 0 0 10px 0;
    color: #1a5490;
    font-size: 1rem;
    text-transform: uppercase;
}

/* Campo con autocompletado */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    display: none;
}

.autocomplete-list div {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.autocomplete-list div:hover {
    background: #eef5fc;
}

.autocomplete-list div small {
    color: #888;
    display: block;
    font-size: 11px;
}

/* Botones */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    margin-right: 5px;
}

.btn-primary { background: #1a5490; color: white; }
.btn-primary:hover { background: #0d3d6e; }

.btn-success { background: #28a745; color: white; }
.btn-success:hover { background: #1e7e34; }

.btn-warning { background: #ffc107; color: #333; }
.btn-warning:hover { background: #e0a800; }

.btn-secondary { background: #6c757d; color: white; }
.btn-secondary:hover { background: #545b62; }

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* Alertas */
.alert {
    padding: 12px 15px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger  { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal-content {
    background: #fff;
    padding: 25px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-top: 0;
    color: #1a5490;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ccc;
    border-top-color: #1a5490;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 768px) {
    body { padding: 8px; }
    .container { padding: 12px; }
    h1 { font-size: 1.2rem; }
    .btn { padding: 8px 14px; font-size: 13px; width: 100%; margin-bottom: 5px; }
    .dignatarios-grid { grid-template-columns: 1fr; }
    input, select, textarea { font-size: 16px; /* evita zoom en iOS */ }
}

/* Indicador de estado */
.status-ok { color: #28a745; font-weight: 600; }
.status-pending { color: #ffc107; font-weight: 600; }
.status-error { color: #dc3545; font-weight: 600; }

/* Campo con nombre autocompletado */
.nombre-autocompletado {
    background: #d4edda !important;
    color: #155724;
    font-weight: 600;
}