/**
 * ========================================================================
 * NEXUS AI - COMPONENTES REUTILIZABLES (BOTONES, TARJETAS, MODALES, ETC.)
 * ========================================================================
 */

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
    user-select: none;
    line-height: 1.2;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}
.btn-primary {
    background: var(--accent-gradient);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.55);
    transform: translateY(-1px);
}
.btn-secondary {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}
.btn-secondary:hover {
    background: var(--bg-surface-hover);
    border-color: var(--text-secondary);
}
.btn-danger {
    background: var(--status-danger);
    color: #ffffff;
}
.btn-danger:hover {
    background: var(--status-danger-hover);
}
.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}
.btn-icon {
    padding: 8px;
    border-radius: var(--radius-md);
}

/* Insignias (Badges) */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-credits {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}
.badge-success {
    background: rgba(46, 160, 67, 0.15);
    color: #3fb950;
    border: 1px solid rgba(46, 160, 67, 0.3);
}
.badge-warning {
    background: rgba(210, 153, 34, 0.15);
    color: #d29922;
    border: 1px solid rgba(210, 153, 34, 0.3);
}
.badge-danger {
    background: rgba(218, 54, 51, 0.15);
    color: #f85149;
    border: 1px solid rgba(218, 54, 51, 0.3);
}

/* Tarjetas */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}
.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Formularios */
.form-group {
    margin-bottom: 18px;
}
.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-darker);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-textarea {
    resize: vertical;
    min-height: 90px;
}
.form-help {
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Tablas */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
}
.data-table th {
    background: var(--bg-surface-elevated);
    color: var(--text-secondary);
    padding: 12px 16px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-subtle);
}
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}
.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Modales */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}
.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}
.modal-dialog {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform var(--transition-normal);
}
.modal-backdrop.active .modal-dialog {
    transform: scale(1);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
}
.modal-body {
    padding: 24px;
}
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
}

/* Toast Notificaciones */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 420px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--accent-primary);
    animation: toastSlideIn 250ms ease-out forwards;
}
.toast-success { border-left-color: var(--status-success-light); }
.toast-error { border-left-color: var(--status-danger); }
.toast-warning { border-left-color: var(--status-warning); }

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Estado Vacío */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}
.empty-title {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.empty-desc {
    font-size: 14px;
    max-width: 400px;
    margin: 0 auto;
}

/* Spinner de carga */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
