/* ===== BOTONES ===== */
.btn-primary {
    padding: 12px 24px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(82, 39, 149, 0.3);
}

.btn-secondary {
    padding: 8px 16px;
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--white);
}

.btn-success,
.btn-finalizar-cobrar {
    padding: 10px 20px;
    background: var(--success-color, #22c55e);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-success:hover,
.btn-finalizar-cobrar:hover {
    background: #16a34a;
    filter: brightness(1.05);
}

.btn-danger {
    padding: 12px 24px;
    background: var(--danger-color, #dc2626);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
}

.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.btn-danger:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

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

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

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

.badge-info {
    background: #cce5ff;
    color: #004085;
}

/* ===== BÚSQUEDA ===== */
.search-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

.search-input {
    padding: 12px 40px 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    width: 100%;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    z-index: 1;
}

.search-clear:hover {
    color: var(--text-primary);
}

.search-clear:active {
    transform: translateY(-50%) scale(0.95);
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    pointer-events: none;
}

/* ===== ESTADOS ===== */
.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active {
    background: #d1fae5;
    color: #065f46;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-completed {
    background: #e9d5ff;
    color: #522795;
}

.status-paid {
    background: #d1fae5;
    color: #065f46;
}

.status-unpaid {
    background: #fee2e2;
    color: #991b1b;
}

/* ===== TABLAS ===== */
.table-container {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

/* Media queries de tablas movidas a responsive.css */

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: #f8fafc;
    border-bottom: 2px solid var(--border-color);
}

.data-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.data-table tbody tr {
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: #f8fafc;
}

/* Columna de acciones fija (sticky) */
.data-table th.sticky-actions,
.data-table td.sticky-actions {
    position: sticky;
    right: 0;
    background-color: var(--white);
    z-index: 10;
    box-shadow: -2px 0 4px rgba(0, 0, 0, 0.1);
}

.data-table thead th.sticky-actions {
    background-color: #f8fafc;
    z-index: 11;
}

.data-table tbody tr:hover td.sticky-actions {
    background-color: #f8fafc;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    flex-direction: row;
    flex-wrap: nowrap;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
}

/*
 * Modal visible: el overlay debe ser un contenedor flex que centre .modal-content.
 * Incluye display:block porque varios flujos (p. ej. wallet en detalle_paciente.js)
 * abren con element.style.display = 'block', que sin esta regla dejaba el contenido arriba-izquierda.
 */
.modal.active,
.modal[style*="display:flex"],
.modal[style*="display: flex"],
.modal[style*="display:block"],
.modal[style*="display: block"] {
    display: flex !important;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--white);
    padding: 30px;
    border-radius: 12px;
    max-width: 600px;
    width: calc(100% - 40px);
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
    margin: 0;
    flex-shrink: 0;
    min-width: 0;
    box-sizing: border-box;
}

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

.modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* Modal cita: X y botón Cancelar Cita en línea, sin superposición */
.cita-modal-header .modal-close-inline {
    position: static;
}

.modal-content h2,
.modal-content h3 {
    margin-bottom: 0;
    margin-top: 0;
    color: var(--primary-color);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 0 20px;
    border-bottom: none;
}

.modal-header h2,
.modal-header h3 {
    margin: 0;
    font-size: 24px;
    color: var(--primary-color);
}

/* ===== FORMULARIOS ===== */
/* Los estilos de formularios están centralizados en forms.css */

/* ===== ALERTAS ===== */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

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

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