/* ============================================
📁 COMPONENTES - Botones, forms, tablas, alerts
=============================================== */

/* --- Botones base --- */
.btn {
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    font-weight: 500;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: #667eea;
    color: white;
}
.btn-primary:hover { background: #5568d3; }

.btn-secondary {
    background: #6c757d;
    color: white;
}
.btn-secondary:hover { background: #5a6268; }

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}
.btn-outline:hover {
    background: #667eea;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
    margin-top: 10px;
}

.btn-action {
    padding: 5px 10px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 3px;
    font-size: 0.85rem;
    transition: background 0.3s;
}
.btn-action:hover { background: #5568d3; }

/* --- Formularios --- */
.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

.form-group input:invalid:not(:placeholder-shown) {
    border-color: #dc3545;
}

.form-group input:readonly {
    background: #f5f5f5;
    border-color: #ddd;
}

.help-text {
    font-size: 0.85rem;
    color: #888;
    margin-top: 5px;
}

/* --- Alertas / Flash messages --- */
.flash-messages {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

.alert {
    padding: 12px 20px;
    border-radius: 5px;
    margin-bottom: 10px;
    animation: slideIn 0.3s ease;
}

.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

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

/* --- Tablas --- */
.table-responsive {
    overflow-x: auto;
}

.contacts-table,
.referidos-table {
    width: 100%;
    border-collapse: collapse;
}

.contacts-table th,
.contacts-table td,
.referidos-table th,
.referidos-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.contacts-table th,
.referidos-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.contacts-table tr:hover,
.referidos-table tr:hover {
    background: #f8f9fa;
}

.contacts-table small {
    color: #888;
    font-size: 0.85rem;
}

.referidos-table code {
    background: #f0f0f0;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.85rem;
}

.actions {
    display: flex;
    gap: 5px;
}

/* --- Paginación --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin: 20px;
    flex-wrap: wrap;
}

.btn-page {
    padding: 8px 15px;
    background: white;
    border: 1px solid #ddd;
    color: #667eea;
    text-decoration: none;
    border-radius: 5px;
    transition: all 0.3s;
}

.btn-page:hover {
    background: #667eea;
    color: white;
}

.btn-page.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.page-current {
    padding: 8px 15px;
    background: #667eea;
    color: white;
    border-radius: 5px;
    font-weight: bold;
}

.page-ellipsis {
    padding: 8px 10px;
    color: #888;
}

/* --- Badges --- */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success  { background: #d4edda; color: #155724; }
.badge-secondary { background: #e2e3e5; color: #383d41; }

/* --- Estado vacío --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    background: #f8f9fa;
    border-radius: 10px;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.empty-state p {
    margin-bottom: 20px;
}